| Electronic Components Datasheet Search |
|
DEV-12935 Datasheet(PDF) 4 Page - SparkFun Electronics |
|
|
|||||||||||||||||||||||||||||
DEV-12935 Datasheet(HTML) 4 Page - SparkFun Electronics |
|
4 / 5 page ![]() #define SEL 2 // When the SEL pin is held low, the data will be // routed to the PC via the USBserial bridge. // That port is also the port used for program ming // by the Arduino IDE. When in bootloading mod e, a // pulldown resistor on the SmartBasic cause s it // to remain in programming mode. #define ARDUINO_IDE LOW // Constants to make our routing ch ange #define AUX_TERMINAL HIGH // more obvious. When the SEL pin is // LOW, data is routed to the // programming port. void setup() { Serial.begin(115200); // Set up the hardware serial port. pinMode(SEL, OUTPUT); // Make the select line an outpu t... digitalWrite(SEL, ARDUINO_IDE); // ...and connect the board to // the Arduino IDE's terminal. } void loop() { // The loop just says "Hello" to the two terminals, over and // over, forever. Note the use of the "flush()" function. I f // omitted, the Arduino will reroute the serial data befor e // the transmission has been completed; flush() causes the // Arduino to block until the serial data output buffer is // empty. Failure to use flush() will result in data being // sent to the wrong device, or to multiplexer changes duri ng // transmission which may cause framing errors or data // corruption. *Always put in a flush() before you change // destination devices or disable the output.* Serial.flush(); digitalWrite(SEL, ARDUINO_IDE); Serial.println("Hello, Arduino IDE!"); // Swap to the nonArduino terminal and say hello. Serial.flush(); digitalWrite(SEL, AUX_TERMINAL); Serial.println("Hello, auxilliary terminal!"); Serial.flush(); delay(500); // This is a ratelimiter only. The temptation t o use // delay() instead of flush() is strong, but fi ght it. // If you use delay, you will *certainly* make a change // to the code which makes the original delay t ime too // short for the new serial data stream, result Page 4 of 5 |
|
|
Link URL |
| Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Contact us | Privacy Policy | Link to Datasheet | Link Exchange | Manufacturer List All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |