| Electronic Components Datasheet Search |
|
DEV-13036 Datasheet(PDF) 9 Page - SparkFun Electronics |
|
|
|||||||||||||||||||||||||||||
DEV-13036 Datasheet(HTML) 9 Page - SparkFun Electronics |
|
9 / 14 page ![]() } void loop() { // Print the value of our Firmata Arduino's A0 pin: int a0Value = firmata_analogRead(0); Serial.print("A0: "); Serial.println(a0Value); // Print the value of our digital input on pin 4: int d4Value = firmata_digitalRead(4); Serial.print("Pin 4: "); Serial.println(d4Value); if (d4Value == LOW) { // Scale the value of A0 to write a PWM output on pin 3: firmata_analogWrite(3, firmata_analogRead(0) / 4); } else { // Scale the value of A0 to write a PWM output on pin 3: firmata_analogWrite(3, 0); } } /////////////////////////////////// // Upper Level Firmata Functions // /////////////////////////////////// // Firmata functions that you should use in your sketch above. // If this was a class, these'd be public functions. // firmata_init() // Initialize our Firmata Serial port. // Set up a timer to read in Serial messages outside of loop (). // Configure our Firmata Arduino to report all digital outpu ts // Configure our Firmata Arduino to report all analog output s void firmata_init() { Serial1.begin(57600); // set a timer of length 100,000 microseconds ( 0.1 sec o r 10Hz) Timer1.initialize(1000); Timer1.attachInterrupt( checkSerial ); // attach the servic e routine here // Turn on reporting for all digital ports for (int i=0; i<16; i++) { Serial1.write(REPORT_DIGITAL | i); Serial1.write(1); } // This function will check for analog channels and set them // to REPORTING firmata_queryAnalogMapping(); } // firmata_digitalRead([pin]) // Returns the latest digital input value we've read on the // requested pin. Page 9 of 14 |
|
|
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 |