1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-12-03 05:41:13 +03:00

Updating Firmata (to r62 of their repository).

Changes include (according to Paul Stoffregen):
"1: Hardware abstraction layer to support Arduino Mega, Teensy and Sanguino.
2: Extended analog message, to facilitate using PWM and Servo above pin 15.
3: Capability queries (alpha), to allow automatic discovery of any board's features."
This commit is contained in:
David A. Mellis
2010-08-06 21:55:17 +00:00
parent 17beb9fcfb
commit 367a0ae9f4
10 changed files with 676 additions and 295 deletions

View File

@@ -23,7 +23,7 @@
#define MAX_QUERIES 8
unsigned long currentMillis; // store the current value from millis()
unsigned long nextExecuteMillis; // for comparison with currentMillis
unsigned long previousMillis; // for comparison with currentMillis
unsigned int samplingInterval = 32; // default sampling interval is 33ms
unsigned int i2cReadDelayTime = 0; // default delay time between i2c read request and Wire.requestFrom()
unsigned int powerPinsEnabled = 0; // use as boolean to prevent enablePowerPins from being called more than once
@@ -192,7 +192,7 @@ void setup()
Firmata.attach(START_SYSEX, sysexCallback);
Firmata.attach(SYSTEM_RESET, systemResetCallback);
for (int i = 0; i < TOTAL_DIGITAL_PINS; ++i) {
for (int i = 0; i < TOTAL_PINS; ++i) {
pinMode(i, OUTPUT);
}
@@ -207,8 +207,8 @@ void loop()
}
currentMillis = millis();
if (currentMillis > nextExecuteMillis) {
nextExecuteMillis = currentMillis + samplingInterval;
if (currentMillis - previousMillis > samplingInterval) {
previousMillis += samplingInterval;
for (byte i = 0; i < queryIndex; i++) {
readAndReportData(query[i].addr, query[i].reg, query[i].bytes);