Firefly – Installation & Setup
This tutorial shows the process of installing Rhino, Aurduino IDE and Firefly. Learn how to construct a basic test program with Firefly to check that everything is working. Also shown is a fix for the ‘WriteToDAC’ error that can occur when uploading the Firefly_Firmata.ino to newer Arduino IDE versions. Download Rhino3D , Arduino IDE and Firefly (Alternate download). The example Grasshopper code is a basic test to check that Firefly is communicating with the Arduino and uses the open port module to start communications and the uno write module to turn on an LED with a boolean toggle. Both modules get the com port via a shared number slider and a shared boolean toggle turns them on. [Note: Change the video quality to 1080p if you are having difficulty making out details]
If the Firefly Firmata uploaded successfully to the Arduino and your Grasshopper code does not work, check that the com port number (being fed into both modules) is correct by finding it in the arduino IDE under the tools/port menu. Also note that Firefly and the Arduino IDE cannot comminicate with the Arduino at the same time. If you have conflicts uploading sketches then toggle the open port to false in Firefly. Likewise if the Arduino IDE serial monitor is open it will interfere with Firefly.
WIRING & GRASSHOPPER CODE
An LED (light emitting diode) requires a resistor inline on either the + or – side to limit the current / brightness. The flat side of the LED rim is the cathode (or the short leg) and connects to negative / ground. The positive voltage gets supplied to the other leg of the LED from the digital output pin of the Arduino. [LED LED(-) → 150Ω → GND, LED(+) → D10]
Firefly_Firmata.ino (Apply the following change to the end of the arduino code if recieving a ‘WriteToDAC’ error on upload)
234 235 236 237 238 239 | void WriteToDAC(int _pin, int _value){ #if defined(__SAM3X8E__) if(_pin == 0) analogWrite(DAC0, _value); else if (_pin == 1) analogWrite(DAC1, _value); #endif } |
0 Comments