Grasshopper

algorithmic modeling for Rhino

Hello. I've seen videos of Grasshopper sketches with firefly and an arduino with DMX out to controll lights. I couldn't manage to include a DMX library into the firefly firmata for arduino. Can somebody help me with it or post an example arduino code?

Views: 1237

Replies to This Discussion

I found a workaround. I didn't use the firmata coming with firefly but the one that is coming from the tinkerit SimpleDMX example. To use the simpleDMX arduino library it with my Conceptinetics DMX Shield I had to use some different jumper settings as if I wanted to use the conceptinetics DMX library.

To send a chanel and a value I had to send a string from grasshopper like 001c255w to send the highest DMX value to chanel 1. See description in my code below:

/*
jumper setup for Conceptinetics DMX shield:
1st jumper to the right: "EN_"
2nd jumper to the right: "DE"
3rd jumper to the left: "TX-io"
4th jumper to the left: "RX-io"

this jumper setup allows the shield to do the following actions without having to change any jumper:
- transfer this arduino sketch to the arduino board
- receive data from the serial port (grasshopper)
- send data to a DMX device

<number>c : Select DMX channel
<number>v : Set DMX channel to new value

These can be combined:
001c255w002c0w003c0w --> Set channel 1 to value 255 and channel 2 and 3 to value 0.
it is important that the channels are being addressed with 3 digits (001c instead of 1c)

http://dmxshield.blogspot.de/
http://playground.arduino.cc/Learning/DMX
http://code.google.com/p/tinkerit/wiki/SerialToDmx
http://groups.google.com/group/dmxsimple
*/

#include <DmxSimple.h>

void setup() {
Serial.begin(9600);
Serial.println("SerialToDmx ready");
Serial.println();
digitalWrite (2, HIGH);
}
int value = 0;
int channel;
void loop() {
int c;
while(!Serial.available());
c = Serial.read();
if ((c>='0') && (c<='9')) {
value = 10*value + c - '0';
} else {
if (c=='c') channel = value;
else if (c=='w') {
DmxSimple.write(channel, value);
}
value = 0;
}
}

Can you tell me if you just used the generic serial component from firefly or were you still sending with the arduinoUno write component. If you can share your GH definition or provide a screen shot it would help to see how you solved this. Thanks very much for the dmx links. I may have some more questions in the future when I get this working. 

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service