Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StandardFirmataPlusWebJack.ino (for advanced firmata features like serial) #19

Open
jywarren opened this issue Nov 27, 2016 · 1 comment

Comments

@jywarren
Copy link
Member

StandardFirmataPlus is a variant of Firmata (for Arduinos, at least in this case) which includes extra features which require a more powerful Arduino than the basic StandardFirmata.

I'd like to try porting in the Webjack changes from the StandardFirmataWebJack.ino which Richard prepared:

https://github.com/publiclab/webjack-firmata/blob/master/sketches/StandardFirmataWebJack/StandardFirmataWebJack.ino

...into the "Plus" version, to get access to things like serialWrite (which I've included in this new demo: https://publiclab.github.io/webjack-firmata/example/serial/)

@rmeister - can you link to the version of StandardFirmataWebJack.ino that this was based on, so we can look at the diffs and try to port over the changes you made to get it working with WebJack?

Thanks!

@jywarren
Copy link
Member Author

OK, reviewing @rmeister's work at:

StandardFirmataWebJack.ino

I made these changes to StandardFirmataPlus.ino from https://github.com/firmata/arduino:

https://gist.github.com/jywarren/b67e032f5e68c282fd328bfec0d1f32b/revisions

Really, only to this section including setup() and a few lines before it:

#include <SoftModem.h>

SoftModem modem = SoftModem();

void setup()
{
  modem.begin();
  delay(100);
  Firmata.setFirmwareVersion(FIRMATA_FIRMWARE_MAJOR_VERSION, FIRMATA_FIRMWARE_MINOR_VERSION);

  Firmata.attach(ANALOG_MESSAGE, analogWriteCallback);
  Firmata.attach(DIGITAL_MESSAGE, digitalWriteCallback);
  Firmata.attach(REPORT_ANALOG, reportAnalogCallback);
  Firmata.attach(REPORT_DIGITAL, reportDigitalCallback);
  Firmata.attach(SET_PIN_MODE, setPinModeCallback);
  Firmata.attach(SET_DIGITAL_PIN_VALUE, setPinValueCallback);
  Firmata.attach(START_SYSEX, sysexCallback);
  Firmata.attach(SYSTEM_RESET, systemResetCallback);

  // to use a port other than Serial, such as Serial1 on an Arduino Leonardo or Mega,
  // Call begin(baud) on the alternate serial port and pass it to Firmata to begin like this:
  // Serial1.begin(57600);
  // Firmata.begin(Serial1);
  // However do not do this if you are using SERIAL_MESSAGE

  Firmata.begin(modem);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for ATmega32u4-based boards and Arduino 101
  }

  systemResetCallback();  // reset to default config
}

I wonder if that'd work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant