Sha256: 58d605af7fafbaf0269582b02dac474f5c2985960b86ce9a219a60213ed23184

Contents?: true

Size: 829 Bytes

Versions: 18

Compression:

Stored size: 829 Bytes

Contents

#include <Firmata.h>

void setup()
{
  Firmata.setFirmwareVersion(FIRMATA_MAJOR_VERSION, FIRMATA_MINOR_VERSION);
  Firmata.attach(START_SYSEX, sysexCallback);
  Firmata.begin(57600);
}

void loop()
{
  while(Firmata.available()) {
    Firmata.processInput();
  }
}

void sysexCallback(byte command, byte argc, byte*argv)
{
  switch(command){
  case 0x01: // LED Blink Command
    if(argc < 3) break;
    byte blink_pin;
    byte blink_count;
    int delayTime;
    blink_pin = argv[0];
    blink_count = argv[1];
    delayTime = argv[2] * 100;

    pinMode(blink_pin, OUTPUT);
    byte i;
    for(i = 0; i < blink_count; i++){
      digitalWrite(blink_pin, true);
      delay(delayTime);
      digitalWrite(blink_pin, false);
      delay(delayTime);
    }
    Firmata.sendSysex(command, argc, argv); // callback
    break;
  }
}

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
arduino_firmata-0.3.7 samples/sysex/SysexLedBlinkFirmata/SysexLedBlinkFirmata.ino
arduino_firmata-0.3.6 samples/sysex/SysexLedBlinkFirmata/SysexLedBlinkFirmata.ino
arduino_firmata-0.3.5 samples/sysex/SysexLedBlinkFirmata/SysexLedBlinkFirmata.ino
arduino_firmata-0.3.4 samples/sysex/SysexLedBlinkFirmata/SysexLedBlinkFirmata.ino
arduino_firmata-0.3.3 samples/sysex/SysexLedBlinkFirmata/SysexLedBlinkFirmata.ino
arduino_firmata-0.3.2 samples/sysex/SysexLedBlinkFirmata/SysexLedBlinkFirmata.ino
arduino_firmata-0.3.1 samples/sysex/SysexLedBlinkFirmata/SysexLedBlinkFirmata.ino
arduino_firmata-0.3.0 samples/sysex/SysexLedBlinkFirmata/SysexLedBlinkFirmata.ino
arduino_firmata-0.2.9 samples/sysex/SysexLedBlinkFirmata/SysexLedBlinkFirmata.ino
arduino_firmata-0.2.8 samples/sysex/SysexLedBlinkFirmata/SysexLedBlinkFirmata.ino
arduino_firmata-0.2.7 samples/sysex/SysexLedBlinkFirmata/SysexLedBlinkFirmata.ino
arduino_firmata-0.2.6 samples/sysex/SysexLedBlinkFirmata/SysexLedBlinkFirmata.ino
arduino_firmata-0.2.5 samples/sysex/SysexLedBlinkFirmata/SysexLedBlinkFirmata.ino
arduino_firmata-0.2.4 samples/sysex/SysexLedBlinkFirmata/SysexLedBlinkFirmata.ino
arduino_firmata-0.2.3 samples/sysex/SysexLedBlinkFirmata/SysexLedBlinkFirmata.ino
arduino_firmata-0.2.2 samples/sysex/SysexLedBlinkFirmata/SysexLedBlinkFirmata.ino
arduino_firmata-0.2.1 samples/sysex/SysexLedBlinkFirmata/SysexLedBlinkFirmata.ino
arduino_firmata-0.2.0 samples/sysex/SysexLedBlinkFirmata/SysexLedBlinkFirmata.ino