diff --git a/eng/ArduinoCsCI.cmd b/eng/ArduinoCsCI.cmd index fb39aef1e0..b6657bb4c3 100644 --- a/eng/ArduinoCsCI.cmd +++ b/eng/ArduinoCsCI.cmd @@ -5,7 +5,7 @@ REM Second argument is either "Debug" or "Release" if %1!==! goto :usage REM Defines the revision to check out in the ExtendedConfigurableFirmata repo -set FIRMATA_SIMULATOR_CHECKOUT_REVISION=122ed75de8cb53e0dbd96cde71a7c9e21fe4be89 +set FIRMATA_SIMULATOR_CHECKOUT_REVISION=e2cfb5223aeb71e3a0756d67619db6c238b6acb5 set RUN_COMPILER_TESTS=FALSE choco install -y --no-progress arduino-cli diff --git a/src/devices/Arduino/ConfigurableFirmata/ConfigurableFirmata.ino b/src/devices/Arduino/ConfigurableFirmata/ConfigurableFirmata.ino deleted file mode 100644 index 659117a186..0000000000 --- a/src/devices/Arduino/ConfigurableFirmata/ConfigurableFirmata.ino +++ /dev/null @@ -1,223 +0,0 @@ -/* - * CommonFirmataFeatures.ino generated by FirmataBuilder - */ - -// Use these defines to easily enable or disable certain modules - -/* Note 1: Currently no client support by dotnet/iot for the following modules, so they're disabled by default */ -/* Enabling all modules on the smaller Arduino boards (such as the UNO or the Nano) won't work anyway, as there is both - * not enough flash as well as not enough RAM. - * - * Note 2: If you get compiler errors or want to test experimental features, it might be better to use the example - * file in the ConfigurableFirmata library (default path C:\Users\\Documents\Arduino\libraries\ConfigurableFirmata\examples\ConfigurableFirmata) - */ -//#define ENABLE_ONE_WIRE -//#define ENABLE_SERVO -//#define ENABLE_ACCELSTEPPER -//#define ENABLE_BASIC_SCHEDULER -//#define ENABLE_SERIAL - -// Support for analog in and analog out (PWM or real DACs, if available) -#define ENABLE_ANALOG -// Support for digital in and digital out -#define ENABLE_DIGITAL - -// I2C support (most boards have just one channel) -#define ENABLE_I2C -// SPI support. This feature requires a non-standard module compiled into the firmware -// #define ENABLE_SPI - -// Native reading of DHTXX sensors. Reading a DHT11 directly using GPIO methods from a remote PC will not work, because of the very tight timing requirements of these sensors -// This feature requires a non-standard module compiled into the firmware (see Readme.md). In addition, the "DHT Sensor library" from Adafruit is required. -// #define ENABLE_DHT - - -#include - -#ifdef ENABLE_DIGITAL -#include -DigitalInputFirmata digitalInput; - -#include -DigitalOutputFirmata digitalOutput; -#endif - -#ifdef ENABLE_ANALOG -#include -AnalogInputFirmata analogInput; - -#include -AnalogOutputFirmata analogOutput; -#endif - -#ifdef ENABLE_I2C -#include -#include -I2CFirmata i2c; -#endif - -#ifdef ENABLE_ONE_WIRE -#include -OneWireFirmata oneWire; -#endif - -#ifdef ENABLE_SERIAL -#include -SerialFirmata serial; -#endif - -#include -FirmataExt firmataExt; - -#ifdef ENABLE_SPI -#include -SpiFirmata spi; -#endif - -#ifdef ENABLE_SERVO -#include -#include -ServoFirmata servo; -#endif -#include - -#ifdef ENABLE_BASIC_SCHDULER -// The scheduler allows to store scripts on the board, however this requires a kind of compiler on the client side. -// When running dotnet/iot on the client side, prefer using the FirmataIlExecutor module instead -#include -FirmataScheduler scheduler; -#endif - -#include -FirmataReporting reporting; - -#ifdef ENABLE_ACCELSTEPPER -#include -AccelStepperFirmata accelStepper; -#endif - -#ifdef ENABLE_DHT -#include -DhtFirmata dhtFirmata; -#endif - -void systemResetCallback() -{ - for (byte i = 0; i < TOTAL_PINS; i++) { - if (IS_PIN_ANALOG(i)) { - Firmata.setPinMode(i, ANALOG); - } else if (IS_PIN_DIGITAL(i)) { - Firmata.setPinMode(i, OUTPUT); - } - } - firmataExt.reset(); -} - -void initTransport() -{ - // Uncomment to save a couple of seconds by disabling the startup blink sequence. - // Firmata.disableBlinkVersion(); - Firmata.begin(115200); - -} - -void initFirmata() -{ - // Set firmware name and version. The name is automatically derived from the name of this file. - // Firmata.setFirmwareVersion(FIRMATA_FIRMWARE_MAJOR_VERSION, FIRMATA_FIRMWARE_MINOR_VERSION); - // The usage of the above shortcut is not recommended, since it stores the full path of the file name in a - // string constant, using both flash and ram. - Firmata.setFirmwareNameAndVersion("ConfigurableFirmata", FIRMATA_FIRMWARE_MAJOR_VERSION, FIRMATA_FIRMWARE_MINOR_VERSION); - -#ifdef ENABLE_DIGITAL - firmataExt.addFeature(digitalInput); - firmataExt.addFeature(digitalOutput); -#endif - -#ifdef ENABLE_ANALOG - firmataExt.addFeature(analogInput); - firmataExt.addFeature(analogOutput); -#endif - -#ifdef ENABLE_SERVO - firmataExt.addFeature(servo); -#endif - -#ifdef ENABLE_I2C - firmataExt.addFeature(i2c); -#endif - -#ifdef ENABLE_ONE_WIRE - firmataExt.addFeature(oneWire); -#endif - -#ifdef ENABLE_SERIAL - firmataExt.addFeature(serial); -#endif - -#ifdef ENABLE_BASIC_SCHEDULER - firmataExt.addFeature(scheduler); -#endif - - firmataExt.addFeature(reporting); -#ifdef ENABLE_SPI - firmataExt.addFeature(spi); -#endif -#ifdef ENABLE_ACCELSTEPPER - firmataExt.addFeature(accelStepper); -#endif - -#ifdef ENABLE_DHT - firmataExt.addFeature(dhtFirmata); -#endif - - Firmata.attach(SYSTEM_RESET, systemResetCallback); -} - -void setup() -{ - initFirmata(); - - initTransport(); - - Firmata.parse(SYSTEM_RESET); -} - -void loop() -{ - while(Firmata.available()) { - Firmata.processInput(); - if (!Firmata.isParsingMessage()) { - goto runtasks; - } - } - if (!Firmata.isParsingMessage()) - { -runtasks: -#ifdef ENABLE_BASIC_SCHEDULER - scheduler.runTasks(); -#else - 0 == 0; // Do something useless (to prevent a compiler error) -#endif - } - - if (reporting.elapsed()) { -#ifdef ENABLE_ANALOG - analogInput.report(); -#endif -#ifdef ENABLE_I2C - i2c.report(); -#endif - } - -#ifdef ENABLE_DIGITAL - digitalInput.report(); -#endif - -#ifdef ENABLE_ACCELSTEPPER - accelStepper.update(); -#endif -#ifdef ENABLE_SERIAL - serial.update(); -#endif -} diff --git a/src/devices/Arduino/README.md b/src/devices/Arduino/README.md index b0dcf54993..7d42372f83 100644 --- a/src/devices/Arduino/README.md +++ b/src/devices/Arduino/README.md @@ -31,8 +31,8 @@ The binding requires Firmata Version 2.6, which is implemented i.e. by the Confi - Open the Arduino IDE - Go to the library manager and check that you have the "ConfigurableFirmata" library installed -- Open "ConfigurableFirmata.ino" from the [device binding folder](./ConfigurableFirmata/ConfigurableFirmata.ino) or go to to create your own custom firmata firmware. Make sure you have at least the features checked that you will need. -- Upload this sketch to your Arduino. +- Load the ConfigurableFirmata sample from the Arduino IDE's sample directory or go to to create your own custom firmata firmware. Make sure you have at least the features checked that you will need. +- Compile and upload this sketch to your Arduino. After these steps, you can start coding with Iot.Devices.Arduino and make your Arduino do whatever you want, from blinking LEDS to your personal weather station. For usage and examples see the samples folder. Note that ConfigurableFirmata uses a default UART speed of 57600 baud. It is recommended to increase it to at least 115200, though. @@ -40,7 +40,7 @@ When the firmware starts, the on-board-LED flashes a few times, indicating the l ### Advanced features -Some of the features of this binding require extended features in the Arduino firmware. These include SPI support and DHT sensor support. These features are only available in the main development branch +Some of the features of this binding require extended features in the Arduino firmware. These include SPI support and DHT sensor support. These features are only available in the main development branch. #### Download for Windows