Arduino Projects: Difference between revisions
m (JMerkle moved page Arduio Projects to Arduino Projects) |
No edit summary |
||
Line 29: | Line 29: | ||
== Blinky == | == Blinky == | ||
Blinky is often the first program used to begin learning the Arduio environment and to test the development board to verify a program can be written, compiled, downloaded, and executed. Blinky is available in the Arduio menu under | Blinky is often the first program used to begin learning the Arduio environment and to test the development board to verify a program can be written, compiled, downloaded, and executed. Blinky is available in the Arduio menu under '''File->Examples->01.Basics->Blink'''.<br> | ||
<strong>Key APIs (functions)</strong><br> | <strong>Key APIs (functions)</strong><br> | ||
* pinMode(LED_BUILTIN, OUTPUT); | * pinMode(LED_BUILTIN, OUTPUT); | ||
Line 36: | Line 36: | ||
== ASCIITable == | == ASCIITable == | ||
ASCIITable is rather boring, but provides an example of how to use the Arduino's serial port to send messages to the console window (or to any serial terminal program.) Since the Arduino platform doesn't provide a debugger, it's often required to add serial print statements into your program to see how the program is progressing, and to see what the values of certain variables might be. ASCIITable is available in the Arduio menu under | ASCIITable is rather boring, but provides an example of how to use the Arduino's serial port to send messages to the console window (or to any serial terminal program.) Since the Arduino platform doesn't provide a debugger, it's often required to add serial print statements into your program to see how the program is progressing, and to see what the values of certain variables might be. ASCIITable is available in the Arduio menu under '''File->Examples->04.Communication->ASCIITable'''.<br> | ||
<strong>Key APIs (functions)</strong><br> | <strong>Key APIs (functions)</strong><br> | ||
* Serial.begin(9600); // Use 9600 for the serial port data rate (9600 and 115200 are very common values) Be sure to tell your Arduio console window the data rate (baud) you selected here. | * Serial.begin(9600); // Use 9600 for the serial port data rate (9600 and 115200 are very common values) Be sure to tell your Arduio console window the data rate (baud) you selected here. |
Latest revision as of 07:54, 12 June 2024
Arduino Projects
I2C
Using I2C with Arduino
- History
- Usage - Applications
- Electrical Interface
Open Collector (Open Drain) - Use of a pull-up resistor to establish a logical high.
* All SCL "clock" signals are connected together * All SDA "data" signals are connected together
Signaling rules: * Inactive bus - no communication: Both SCL and SDA signals are high * For normal data flow, the SCL must be low when the SDA signal changes. * Start Condition: With SCL high, the SDA signal is pulled low. This condition wakes all the I2C devices on the bus, alerting them to begin watching for their address. * Stop Condition: With the SCL high, the SDA signal is raised from low to high. This condition signals all the devices on the bus that communication is complete with the current device, and the bus should return to an idle state.
* Any of the devices connected to this bus has the ability to pull its associated I2C bus signal low. The pull-up resistor will pull the signals to a high state when none of the I2C devices are pullin the signal low. When both the "SCL" and "SDA" signal are both at stable high level, the bus is considered "inactive" or available (usually following a Stop condition).
- Supporting Information
Texas Instruments, Understanding the I2C Bus, http://www.ti.com/lit/an/slva704/slva704.pdf
History of the I2C Bus, http://www.esacademy.com/en/library/technical-articles-and-documents/miscellaneous/i2c-bus/general-introduction/history-of-the-i2c-bus.html
Arduino I2C Scanner, https://playground.arduino.cc/Main/I2cScanner/
Blinky
Blinky is often the first program used to begin learning the Arduio environment and to test the development board to verify a program can be written, compiled, downloaded, and executed. Blinky is available in the Arduio menu under File->Examples->01.Basics->Blink.
Key APIs (functions)
- pinMode(LED_BUILTIN, OUTPUT);
- digitalWrite(LED_BUILTIN, HIGH);
- delay(1000);
ASCIITable
ASCIITable is rather boring, but provides an example of how to use the Arduino's serial port to send messages to the console window (or to any serial terminal program.) Since the Arduino platform doesn't provide a debugger, it's often required to add serial print statements into your program to see how the program is progressing, and to see what the values of certain variables might be. ASCIITable is available in the Arduio menu under File->Examples->04.Communication->ASCIITable.
Key APIs (functions)
- Serial.begin(9600); // Use 9600 for the serial port data rate (9600 and 115200 are very common values) Be sure to tell your Arduio console window the data rate (baud) you selected here.
- Serial.print("Fred"); // Display the text, "Fred"
- Serial.println("Some text to display"); // Display the text, "Some text to display", and begin a new line below it
- Serial.write(thisByte); // Display the ASCII representation of the byte, "thisByte"