Using the SD library to log data This example shows how to use the SD card Library to log data from three analog sensors to a SD card. Please click here for more information on the SD library. Hardware Required Arduino board Ethernet Shield (or other board with an SD slot) 3 10k ohm potentiometers hook-up wires breadboard Formatted SD card Circuit The Arduino board has to be connected to the Ethernet Shield. The three potentiometers may be substituted with other analog sensors, to be wired according to their interfacing techniques. Schematics Code The code below is configured for use with an Ethernet shield, which has an onboard SD slot. In the setup() , call SD.begin() , naming pin 4 as the CS pin. This pin varies depending on the make of shield or board. In the loop() , a String is created to hold the information from three analog sensors. The code iterates through the sensors, adding their data to the string. Next, the file on the SD card is opened by calling SD.open() . Once available, the data is written to the card when dataFile.println() is used. The file must be closed with dataFile.close() to save the information. See Also SD library - Your reference for the SD Card library. Notes on using SD cards - What you need to know when you use SD cards CardInfo - Get info about your SD card. DumpFile - How to read a file from the SD card. Files - How to create and destroy an SD card file. Listfiles - How print out the files in a directory on a SD card. ReadWrite - How to read and write data to and from an SD card. Last revision 2015/08/17 by SM
Using the SD library to read and write to a file on a SD card This example shows how to read and write data to and from an SD card. Please click here for more information on the SD library. Hardware Required Arduino board Ethernet Shield (or other board with an SD slot) Formatted SD card Circuit image developed using Fritzing . For more circuit examples, see the Fritzing project page The Arduino board has to be connected to the Ethernet Shield and also has a USB cable connected to the computer. Schematics image developed using Fritzing . For more circuit examples, see the Fritzing project page Code The code below is configured for use with an Ethernet shield, which has an onboard SD slot. In the setup() , we call SD.begin() , naming pin 4 as the CS pin. This pin varies depending on the make of shield or board you are using. In setup() , create a new file with SD.open() named "test.txt". FILE_WRITE enables read and write access to the file, starting at the end. If a file "test.txt" was already on the card, that file would be opened. Name the instance of the opened file "myFile". Once opened, use myFile.println() to write a string to the card, followed by a carriage return. Once the content is written, close the file. Again, open the file with SD.open() . Once opened, ask the Arduino to read the contents of the file with SD.read() and send them over the serial port. After all the contents of the file are read, close the file with SD.close() . See Also SD library - Your reference for the SD Card library. Notes on using SD cards - What you need to know when you use SD cards CardInfo - Get info about your SD card. Datalogger - How to log data from three analog sensors to an SD card. DumpFile - How to read a file from the SD card. Files - How to create and destroy an SD card file. Listfiles - How print out the files in a directory on a SD card. Last revision 2015/08/18 by SM
Using the SD library to retrieve information over a serial port This example shows how to read information about a SD card. The example reports volume type, free space and other information using the SD library, sending it over the serial port. Please click here for more information on the SD library. Hardware Required Arduino board Ethernet Shield (or other board with an SD slot) Formatted SD card Circuit image developed using Fritzing . For more circuit examples, see the Fritzing project page The Arduino board has to be connected to the Ethernet Shield and also has a USB cable connected to the computer. Schematics image developed using Fritzing . For more circuit examples, see the Fritzing project page Code The code below is configured for use with an Ethernet shield, which has an onboard SD slot. In the setup() , call SD.begin() , naming pin 4 as the CS pin. This pin varies depending on the make of shield or board you are using. The code uses some undocumented utility libraries to report information about the SD card. This information includes formatting (FAT16 or FAT32) and file structure, as well as the amount of free space and space used on the card. Please note: the cluster size is defined at format time by the user and has some default values that can be changed by users following some rules. In the sketch above we are using the default size for a block that is set at 512 bytes by standards. This value is not the cluster size : that is calculated as the number of blocks per cluster. You may find more in depth information about cluster sizes in this article . See Also SD library - Your reference for the SD Card library. Notes on using SD cards - What you need to know when you use SD cards Datalogger - How to log data from three analog sensors to an SD card. DumpFile - How to read a file from the SD card. Files - How to create and destroy an SD card file. Listfiles - How print out the files in a directory on a SD card. ReadWrite - How to read and write data to and from an SD card. Last revision 2018/03/01 by SM
Using the SD library to retrieve information over a serial port This example shows how to read a file from a SD card using the SD library and send it over the serial port. Please click here for more information on the SD library. Hardware Required Arduino board Ethernet Shield (or other board with an SD slot) Formatted SD card with a file named "datalog.txt" containing some text Circuit image developed using Fritzing . For more circuit examples, see the Fritzing project page The Arduino board has to be connected to the Ethernet Shield and also has a USB cable connected to the computer. Schematics image developed using Fritzing . For more circuit examples, see the Fritzing project page Code The code below is configured for use with an Ethernet shield, which has an onboard SD slot. In the setup() , call SD.begin() , naming pin 4 as the CS pin. This pin varies depending on the make of shield or board you are using. On the SD card, there is a file named "datalog.txt". In the loop() , the file is opened when calling SD.open() . To send the file serially to a computer, use Serial.print() , reading the contents of the file with SD.read() . See Also SD library - Your reference for the SD Card library. Notes on using SD cards - What you need to know when you use SD cards CardInfo - Get info about your SD card. Datalogger - How to log data from three analog sensors to an SD card. Files - How to create and destroy an SD card file. Listfiles - How print out the files in a directory on a SD card. ReadWrite - How to read and write data to and from an SD card. Last revision 2015/08/18 by SM
Arduino - WiFi101ThingSpeakDataUploader WiFi 101 ThingSpeak Data Uploader This tutorial demonstrates how to use the Arduino Zero or Arduino Uno and the WiFi101 shield to send a live stream of the light and temperature values in your environment using ThingSpeak.com . ThingSpeak is an open data platform for the Internet of Things which allows you to collect data in a your own channel and get data from other channels using the API. In this example, we will use a photocell and a temperature sensor and send their values wirelessly to the ThingSpeak server. Hardware Required Arduino Zero or Uno Board Arduino Wifi Sheild 101 Photocell Temperature Sensor (This example uses a TMP36 ) 10K Ohm Resistor The Circuit The Wifi Shield 101 sits on top of the Zero/Uno. The photocell should be connected with one leg to pin A0 and the other to ground via the 10K Ohm resistor. As with ordinary resistors, photocells do not have polarity so it does not matter which leg is connected to which pin. The temperature sensor has three pins: Power, Voltage out and Ground. In this case it is important that pin 1 goes to power and pin 3 goes to ground, and the middle leg of the sensor (voltage out) is then connected to pin A1, as seen in the circuit below. image developed using Fritzing . For more circuit examples, see the Fritzing project page In the above image, the board would be stacked below the WiFi Shield 101. Creating a Channel on ThingSpeak First of all, it is necessary to create a channel on ThingSpeak.com to which the data can be uploaded. To do this, navigate to www.thingspeak.com in your web browser and Sign Up with a new account or with an existing MathWorks account. You can then Create a Channel , give your channel a name such as "Arduino Channel" and a description, such as "Light and temperature values from my environment". Tick the boxes next to Field 1 and Field 2, naming them "Light" and "Temperature" respectively. The rest of the fields are optional and example information is found in Channel Settings on the same page. Hit save channel, and you will be taken to the current view of your new channel. Go to the API Keys tab and find your Write API Key . You will need to insert this into the sketch in order to write to your channel. Code This sketch simply continuously reads the values of the thermistor and photocell inside the loop and stores them in a string, and every 20 seconds the current values of the analog sensors are sent to your channel. Before using the program, your wireless network's SSID and its password must be entered into the following lines in the code: Then in the ThingSpeak settings, the Write API Key described in the previous section must be inserted into the String APIKey. Optionally, the duration of time in between updates can be changed in updateThingSpeakInterval: The analog value of range 0-1023 from the temperature sensor is converted into a temperature value in degrees Celcius by first converting the sensor value to a voltage. From the datasheet , we can see that the offset voltage for the TMP36 is 0.5V (Note: the TMP37 and TMP35 do not have an offset Voltage), therefore the temperature can be read using formula Temp ° C = 100 * (voltageReading - 0.5). Strings must be sent to ThingSpeak, therefore a conversion is required. The light value straight from the A0 pin and the previously calculated temperature are cast to strings. An if statement inside the loop then determines whether the specified amount of time has passed and whether the client is disconnected. If so, the function updateThingSpeak sends the string values of light and temperature to fields 1 and 2 respectively: The full code can be found below. Upon running the sketch, you can go to your channel and view your Private/Public channel and see the Channel Stats . You should have two graphs, the first showing light and the second temperature. You can now watch this dynamic graph change without refreshing the page. You can also use the MatLab or thingspeak.com/apps to visualise and trigger actions from the data.
MicroGamerA library for content creation on the Micro:Gamer gaming platform
Library
TinkerControllerTinkerController allows you to use Gaming Controllers with your Arduino/ESP IOT devices.
Reference
ArduboyThe Arduboy core library.
This library is for content creation on the Arduboy, a portable gaming platform. The library provides access to the sound, display, and input of the Arduboy.
AVR
Reference
Grove 3-Axis Digital GyroArduino library to control Grove 3-Axis Digital Gyro base on ITG 3200.
Grove 3-axis Gyro module based on ITG 3200. It is the world’s first single-chip, digital-output, 3-axis MEMS motion processing gyro optimized for gaming, 3D mice, and motion-based remote control applications for Internet connected Digital TVs and Set Top Boxes.
All Architectures
Reference
lcdgfxVGA, SSD1306, SSD1331, SSD1325/SSD1327, SSD1351, IL9163/ST7735, ST7789, ILI9341, PCD8544, SH1106/SH1107 spi/i2c OLED/LED Display driver.
Provides API for working with 128x64 and 128x32 monochrome/color oled displays over i2c/spi, and VGA monitor. The supported displays include IL9163 128x128, ST7735 128x160, SSD1331 96x64, SSD1351 128x128, PCD8544 84x48, SH1107, SH1106. The library implements graphical engine, allowing creation of dynamic animation, and can be used for gaming development. The library is intended for use with small microcontrollers with a little of SRAM. It includes both internal own i2c communication implementation and can use Wire library.
All Architectures
Reference
MicroGamerA library for content creation on the Micro:Gamer gaming platform
This is a fork of the Arduboy2 library, for the Micro:Gamer.
NRF5
Reference
ssd1306Display driver for VGA, SSD1306, SSD1325/SSD1327, SSD1331, SSD1351, ILI9163/ST7735, ILI9341, PCD8544.
Provides API for working with monochrome and color oled/lcd displays over i2c/spi, and VGA monitor. The library implements graphical engine, allowing creation of dynamic animation, and can be used for gaming development. The library has one of the smallest footprints.
All Architectures
Reference
TinkerControllerTinkerController allows you to use Gaming Controllers with your Arduino/ESP IOT devices.
An open-source Game Controller App that allows you to use an Xbox/Ps4/Joycon or any controller that works with your phone to effortlessly control most micro-controllers such as Arduino/Esp8266/Raspberry Pi over WiFi, bluetooth, or USB.