Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <DmxSimple.h>
- #include "SPI.h"
- char canais [512];
- volatile boolean received_flag;
- int dmxpin = 5;
- void setup() {
- DmxSimple.usePin(dmxpin);
- SPCR |= bit (SPE);
- pinMode(MISO, OUTPUT);
- received_flag = false;
- SPI.attachInterrupt();
- }
- void loop() {
- if (received_flag){
- for (int i=1;i<513;i++){
- DmxSimple.write(i,canais[i]);
- }
- received_flag = false;
- }
- }
- ISR (SPI_STC_vect) {
- for (int i=1;i<513;i++){
- canais [i] = SPDR;
- }
- received_flag = true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement