Closed ozyeng closed 4 years ago
I'm trying to light up red, green and blue leds using two arduinos
I can send the proper DMX signal but i cant receive.
Here is the sender arduino's code;
#include <DMXSerial.h> void setup() { DMXSerial.init(DMXController,2); DMXSerial.maxChannel(3); } void loop() { DMXSerial.write(1, 255); DMXSerial.write(2, 0); DMXSerial.write(3, 255); }
and the receiver arduino;
#include <DMXSerial.h> const int RedPin = 9; // PWM output pin for Red Light. const int GreenPin = 6; // PWM output pin for Green Light. const int BluePin = 5; // PWM output pin for Blue Light. void setup() { DMXSerial.init(DMXReceiver,2); DMXSerial.maxChannel(3); pinMode(RedPin, OUTPUT); // sets the digital pin as output pinMode(GreenPin, OUTPUT); pinMode(BluePin, OUTPUT); } void loop() { unsigned long lastPacket = DMXSerial.noDataSince(); if (lastPacket < 1000) { analogWrite(RedPin, DMXSerial.read(1)); analogWrite(GreenPin, DMXSerial.read(2)); analogWrite(BluePin, DMXSerial.read(3)); } else{ analogWrite(RedPin,255); } }
Here is my proteus design;
Is there a problem with my code or is this a simulation problem ?
Maybe the simulating doesn't handle the interrupt driven output correctly because I cannot see the break in the oscilloscope. I can't see a wiring topic here you just try in real hardware.
I'm trying to light up red, green and blue leds using two arduinos
I can send the proper DMX signal but i cant receive.
Here is the sender arduino's code;
and the receiver arduino;
Here is my proteus design;
Is there a problem with my code or is this a simulation problem ?