first commit

This commit is contained in:
Miguel 2025-02-25 21:21:58 +01:00
commit e3c1e05da4
627 changed files with 24126 additions and 0 deletions

View file

@ -0,0 +1,82 @@
//programacio maquina.definitivo1//prueba delays
int ledPinA = 5;
int ledPinR = 8;
int ledPinV = 9;
unsigned long time=0;
long seg;
int botonPin;
int val;
int servoPin = 3; // Control pin for servo motor
int maxPulse = 1912; // Maximum servo position
int minPulse= -2400; // Minimum servo position
int pulse = 1600; // Amount to pulse the servo
long lastPulse = 0; // the time in milliseconds of the last pulse
int refreshTime = 20; // the time needed in between pulses
void setup(){
Serial.begin(9600);
pinMode(ledPinA, OUTPUT); // sets the digital pin as output
pinMode(ledPinR, OUTPUT);
pinMode(ledPinV, OUTPUT);
pinMode(botonPin, INPUT);
pinMode(servoPin, OUTPUT); // Set servo pin as an output pin
}
void loop(){
// pulse the servo again if rhe refresh time (20 ms) have passed:
digitalWrite(servoPin, HIGH); // Turn the motor on
delayMicroseconds(pulse); // Length of the pulse sets the motor position
digitalWrite(servoPin, LOW); // Turn the motor off
delayMicroseconds (refreshTime);
Serial.print (" Pulse:");
Serial.println (pulse);
time=millis();
seg=time/1000;
switch(seg){
case (1/2):
digitalWrite (ledPinV, HIGH);
digitalWrite(ledPinA,HIGH);
digitalWrite(ledPinR,LOW);
break;
//126
case 136:
//digitalWrite (ledPinV, LOW);
digitalWrite(ledPinA,LOW);
digitalWrite (ledPinV, HIGH);
digitalWrite(ledPinR,LOW);
break;
//128
case 138:
pulse=1600;
break;
case 144:
digitalWrite (ledPinV, HIGH);
digitalWrite(ledPinR,LOW);
pulse=919;
break;
//164
case 184:
digitalWrite (ledPinV, HIGH);
digitalWrite(ledPinR,LOW);
pulse=2400;
break;
//196
case 200:
digitalWrite (ledPinV,LOW);
digitalWrite(ledPinR,HIGH);
pulse=1650;
//delay(500);
break;
}
Serial.println(seg);
}

View file

@ -0,0 +1,98 @@
//programacio maquina.definitivo1//prueba delays
#include "WProgram.h"
void setup();
void loop();
int ledPinA = 5;
int ledPinR = 8;
int ledPinV = 9;
unsigned long time=0;
long seg;
int botonPin;
int val;
int servoPin = 3; // Control pin for servo motor
int maxPulse = 1912; // Maximum servo position
int minPulse= -2400; // Minimum servo position
int pulse = 1600; // Amount to pulse the servo
long lastPulse = 0; // the time in milliseconds of the last pulse
int refreshTime = 20; // the time needed in between pulses
void setup(){
Serial.begin(9600);
pinMode(ledPinA, OUTPUT); // sets the digital pin as output
pinMode(ledPinR, OUTPUT);
pinMode(ledPinV, OUTPUT);
pinMode(botonPin, INPUT);
pinMode(servoPin, OUTPUT); // Set servo pin as an output pin
}
void loop(){
// pulse the servo again if rhe refresh time (20 ms) have passed:
digitalWrite(servoPin, HIGH); // Turn the motor on
delayMicroseconds(pulse); // Length of the pulse sets the motor position
digitalWrite(servoPin, LOW); // Turn the motor off
delayMicroseconds (refreshTime);
Serial.print (" Pulse:");
Serial.println (pulse);
time=millis();
seg=time/1000;
switch(seg){
case (1/2):
digitalWrite (ledPinV, HIGH);
digitalWrite(ledPinA,HIGH);
digitalWrite(ledPinR,LOW);
break;
//126
case 136:
//digitalWrite (ledPinV, LOW);
digitalWrite(ledPinA,LOW);
digitalWrite (ledPinV, HIGH);
digitalWrite(ledPinR,LOW);
break;
//128
case 138:
pulse=1600;
break;
case 144:
digitalWrite (ledPinV, HIGH);
digitalWrite(ledPinR,LOW);
pulse=919;
break;
//164
case 184:
digitalWrite (ledPinV, HIGH);
digitalWrite(ledPinR,LOW);
pulse=2400;
break;
//196
case 200:
digitalWrite (ledPinV,LOW);
digitalWrite(ledPinR,HIGH);
pulse=1650;
//delay(500);
break;
}
Serial.println(seg);
}
int main(void)
{
init();
setup();
for (;;)
loop();
return 0;
}

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,188 @@
:100000000C945B000C9483000C9483000C9483008C
:100010000C9483000C9483000C9483000C94830054
:100020000C9483000C9483000C9483000C94830044
:100030000C9483000C9483000C9483000C94830034
:100040000C940D030C9483000C9419050C948300FC
:100050000C9483000C9483000C9483000C94830014
:100060000C9483000C948300000024272A000025B0
:10007000282B000023262904040404040404040299
:100080000202020202030303030303010204081035
:100090002040800102040810200102040810200002
:1000A0000000070002010000030406000000000039
:1000B00000000000650111241FBECFEFD4E0DEBFB9
:1000C000CDBF11E0A0E0B1E0E4E8FBE002C00590A4
:1000D0000D92AE31B107D9F711E0AEE1B1E001C048
:1000E0001D92AC3BB107E1F710E0C6EBD0E004C0D5
:1000F0002297FE010E94BC05C43BD107C9F70E94AC
:100100005E010C94C0050C94000061E080910E012A
:100110000E94080480911401909115010E94A2038D
:1001200060E080910E010E94080480911601909178
:1001300017010E94A20360E071E08EE291E00E944C
:100140008E0160911401709115018EE291E00E9480
:10015000DD020E946A0360931E0170931F01809369
:1001600020019093210128EE33E040E050E00E940E
:100170006905C901DA018093220190932301A093BC
:100180002401B09325018A389105A105B105D1F16B
:100190008B389105A105B1055CF40097A105B10567
:1001A000C1F088389105A105B10509F058C01AC001
:1001B000883B9105A105B105A9F1883C9105A105F0
:1001C000B105E9F180399105A105B10509F047C0F4
:1001D0001CC061E080910C010E94080461E08091E4
:1001E000080108C060E0809108010E94080461E0F5
:1001F00080910C010E94080460E080910A010E9435
:1002000008042DC080E496E026C061E080910C01D6
:100210000E94080460E080910A010E94080487E9B6
:1002200093E019C061E080910C010E94080460E035
:1002300080910A010E94080480E699E00CC060E009
:1002400080910C010E94080461E080910A010E94E3
:10025000080482E796E09093150180931401409181
:1002600022015091230160912401709125018EE2B9
:1002700091E00E94CA02089540E855E260E070E013
:100280008EE291E00E94790161E0809108010E9474
:10029000EA0361E080910A010E94EA0361E0809133
:1002A0000C010E94EA0360E0809126010E94EA03AB
:1002B00061E080910E010E94EA0308950E94B0035C
:1002C0000E943C010E948500FDCF8CE191E090935B
:1002D0002F0180932E010895862F0E94D80408953F
:1002E0000E94100508950E94F10408950E94E00400
:1002F0000895CB01BA010E949F040895DC01ED919D
:10030000FC910190F081E02D09950895DC01ED91BB
:10031000FC910190F081E02D099508950F931F93B2
:10032000CF93DF938C01EB0109C02196D801ED91A9
:10033000FC910190F081E02DC80109956881662348
:10034000A1F7DF91CF911F910F9108950F931F9304
:100350008C01DC01ED91FC910190F081E02D6DE0CC
:100360000995D801ED91FC910190F081E02D6AE0B2
:10037000C80109951F910F9108950F931F938C0148
:10038000DC01ED91FC910190F081E02D0995C8010F
:100390000E94A6011F910F9108950F931F938C0146
:1003A0000E948E01C8010E94A6011F910F9108951D
:1003B0000F931F938C01DC01ED91FC910190F08172
:1003C000E02D0995C8010E94A6011F910F91089583
:1003D0002F923F924F925F926F927F928F929F9255
:1003E000AF92BF92CF92DF92EF92FF920F931F9343
:1003F000DF93CF93CDB7DEB7A0970FB6F894DEBFEB
:100400000FBECDBF1C016A017B014115510561057D
:10041000710549F4DC01ED91FC910190F081E02D32
:1004200060E3099554C0882499245401422E552430
:100430006624772401E010E00C0F1D1F080D191D24
:10044000C701B601A30192010E946905F80160830A
:100450000894811C911CA11CB11CC701B601A30109
:1004600092010E946905C901DA016C017D01C11484
:10047000D104E104F104F1F681E0E82EF12CEC0E58
:10048000FD1EE80CF91C3E010894611C711CD5018D
:10049000C4010197A109B1096C01C818D90814C099
:1004A000F601EE0DFF1D60816A3010F4605D01C041
:1004B000695CD101ED91FC910190F081E02DC101C9
:1004C00009950894E108F1086E147F0449F7A09695
:1004D0000FB6F894DEBF0FBECDBFCF91DF911F9155
:1004E0000F91FF90EF90DF90CF90BF90AF909F90D3
:1004F0008F907F906F905F904F903F902F900895D6
:100500002AE00E94E80108950F931F938C010E9436
:100510008002C8010E94A6011F910F910895AB01AE
:1005200060E070E00E94800208950F931F938C0199
:10053000AB0160E070E00E948002C8010E94A60149
:100540001F910F910895EF92FF920F931F93CF93F6
:10055000DF93EC017A018B0177FF0FC0E881F9810D
:100560000190F081E02D6DE2099510950095F094D1
:10057000E094E11CF11C011D111D2AE0B801A70146
:10058000CE010E94E801DF91CF911F910F91FF9062
:10059000EF9008950F931F938C010E94A302C8014E
:1005A0000E94A6011F910F910895AB01662757FD88
:1005B0006095762F0E94A30208950F931F938C01DC
:1005C000AB01662757FD6095762F0E94A302C801F4
:1005D0000E94A6011F910F910895DC01211531059C
:1005E00041F4ED91FC910190F081E02D642F09958B
:1005F00008952A30310519F40E94A30208950E943B
:10060000E80108950F931F938C010E94ED02C80129
:100610000E94A6011F910F9108951F920F920FB68D
:100620000F9211242F938F939F93AF93BF93809139
:10063000300190913101A0913201B091330180508D
:10064000904CAF4FBF4F8093300190933101A093F6
:100650003201B093330127C0809130019091310174
:10066000A0913201B091330180589E43A040B04028
:100670008093300190933101A0933201B093330104
:100680008091340190913501A0913601B0913701EC
:100690000196A11DB11D8093340190933501A09363
:1006A0003601B09337018091300190913101A091D2
:1006B0003201B091330181589E43A040B04060F6B2
:1006C000BF91AF919F918F912F910F900FBE0F907F
:1006D0001F9018958FB7F89420913401309135010F
:1006E00040913601509137018FBFB901CA01089579
:1006F000EF92FF920F931F937B018C018FB7F894B9
:10070000409134015091350160913601709137016B
:100710008FBF2FB7F8948091340190913501A0914B
:100720003601B09137012FBF841B950BA60BB70B79
:100730008E159F05A007B10760F31F910F91FF90E1
:10074000EF900895019759F0FC01EE0FFF1FEE0F97
:10075000FF1F32978FB7F8943197F1F78FBF089545
:10076000789484B5826084BD84B5816084BD85B58C
:10077000826085BD85B5816085BDEEE6F0E0808153
:1007800081608083E1E8F0E0808182608083808105
:1007900081608083E0E8F0E0808181608083E1EB2C
:1007A000F0E0808184608083E0EBF0E08081816014
:1007B0008083EAE7F0E080818460808380818260CA
:1007C00080838081816080838081806880831092B3
:1007D000C1000895282F30E0C90185579F4FFC01C3
:1007E000949129583F4FF9018491882381F0E82F93
:1007F000F0E0E859FF4FE491F0E0662329F48081AE
:1008000090958923808308958081892B8083089522
:10081000482F50E0CA0181569F4FFC012491CA0124
:1008200085579F4FFC01949149585F4FFA013491CD
:100830003323C1F1222331F1233021F48091800050
:100840008F7705C0243031F4809180008F7D8093B4
:10085000800018C0213019F484B58F7704C022308D
:1008600021F484B58F7D84BD0DC0263021F48091A4
:10087000B0008F7705C0273029F48091B0008F7DBC
:100880008093B000E32FF0E0E359FF4FE491F0E0F4
:10089000662329F48081909589238083089580813F
:1008A000892B80830895482F50E0CA0181569F4FBD
:1008B000FC012491CA0185579F4FFC01949149582E
:1008C0005F4FFA013491332319F420E030E035C052
:1008D000222331F1233021F4809180008F7705C0ED
:1008E000243031F4809180008F7D8093800018C087
:1008F000213019F484B58F7704C0223021F484B5F7
:100900008F7D84BD0DC0263021F48091B0008F779B
:1009100005C0273029F48091B0008F7D8093B0000E
:10092000E32FF0E0EE58FF4FE491F0E0808120E00B
:1009300030E0892311F021E030E0C9010895EF9201
:10094000FF920F931F937B018C0122E030E040E087
:1009500050E00E948B05205C3D4B404F5F4FCA0129
:10096000B901A80197010E948B05C901DA0101971D
:10097000A109B109292F3A2F4B2F552747FD5A9529
:100980000196A11DB11D2093C50081508093C40024
:10099000E1ECF0E0808180618083808188608083E9
:1009A0008081806880831F910F91FF90EF90089560
:1009B000982F8091C00085FFFCCF9093C6000895CA
:1009C000809138019091390180589F4F20913A01D0
:1009D00030913B01821B930B60E870E00E9456054A
:1009E000089540913A0150913B01809138019091D6
:1009F00039018417950719F42FEF3FEF0FC0FA0163
:100A0000E45CFE4F2081CA01019660E870E00E941C
:100A1000560590933B0180933A0130E0C901089557
:100A200080913A0190913B01909339018093380174
:100A300008951F920F920FB60F9211242F933F9398
:100A40004F935F936F937F938F939F93AF93BF93D6
:100A5000EF93FF934091C600E0913801F091390186
:100A6000CF01019660E870E00E9456059C018091DC
:100A70003A0190913B012817390739F0E45CFE4FA9
:100A800040833093390120933801FF91EF91BF915A
:100A9000AF919F918F917F916F915F914F913F9116
:100AA0002F910F900FBE0F901F90189597FB092E56
:100AB00007260AD077FD04D049D006D000201AF4CA
:100AC000709561957F4F0895F6F7909581959F4FAA
:100AD0000895A1E21A2EAA1BBB1BFD010DC0AA1F7F
:100AE000BB1FEE1FFF1FA217B307E407F50720F097
:100AF000A21BB30BE40BF50B661F771F881F991F12
:100B00001A9469F760957095809590959B01AC015A
:100B1000BD01CF01089597FB092E05260ED057FD84
:100B200004D0D7DF0AD0001C38F45095409530959A
:100B300021953F4F4F4F5F4F0895F6F79095809561
:100B4000709561957F4F8F4F9F4F0895AA1BBB1BD8
:100B500051E107C0AA1FBB1FA617B70710F0A61BBD
:100B6000B70B881F991F5A95A9F780959095BC01DE
:100B7000CD010895EE0FFF1F0590F491E02D09942B
:040B8000F894FFCF17
:100B84002050756C73653A000500080009000300E5
:0E0B94007807A0F640061400000000006C0177
:00000001FF

View file

@ -0,0 +1,82 @@
//programacio maquina.definitivo1//prueba delays
int ledPinA = 5;
int ledPinR = 8;
int ledPinV = 9;
unsigned long time=0;
long seg;
int botonPin;
int val;
int servoPin = 3; // Control pin for servo motor
int maxPulse = 1912; // Maximum servo position
int minPulse= -2400; // Minimum servo position
int pulse = 1600; // Amount to pulse the servo
long lastPulse = 0; // the time in milliseconds of the last pulse
int refreshTime = 20; // the time needed in between pulses
void setup(){
Serial.begin(9600);
pinMode(ledPinA, OUTPUT); // sets the digital pin as output
pinMode(ledPinR, OUTPUT);
pinMode(ledPinV, OUTPUT);
pinMode(botonPin, INPUT);
pinMode(servoPin, OUTPUT); // Set servo pin as an output pin
}
void loop(){
// pulse the servo again if rhe refresh time (20 ms) have passed:
digitalWrite(servoPin, HIGH); // Turn the motor on
delayMicroseconds(pulse); // Length of the pulse sets the motor position
digitalWrite(servoPin, LOW); // Turn the motor off
delayMicroseconds (refreshTime);
Serial.print (" Pulse:");
Serial.println (pulse);
time=millis();
seg=time/1000;
switch(seg){
case (1/2):
digitalWrite (ledPinV, HIGH);
digitalWrite(ledPinA,HIGH);
digitalWrite(ledPinR,LOW);
break;
//126
case 136:
//digitalWrite (ledPinV, LOW);
digitalWrite(ledPinA,LOW);
digitalWrite (ledPinV, HIGH);
digitalWrite(ledPinR,LOW);
break;
//128
case 138:
pulse=1600;
break;
case 144:
digitalWrite (ledPinV, HIGH);
digitalWrite(ledPinR,LOW);
pulse=919;
break;
//164
case 184:
digitalWrite (ledPinV, HIGH);
digitalWrite(ledPinR,LOW);
pulse=2400;
break;
//196
case 200:
digitalWrite (ledPinV,LOW);
digitalWrite(ledPinR,HIGH);
pulse=1650;
//delay(500);
break;
}
Serial.println(seg);
}

View file

@ -0,0 +1,189 @@
S02B0000433A5C446F63756D656E747320616E642053657474696E67735C48616E6761725C4573637269746FA3
S11300000C945B000C9483000C9483000C94830088
S11300100C9483000C9483000C9483000C94830050
S11300200C9483000C9483000C9483000C94830040
S11300300C9483000C9483000C9483000C94830030
S11300400C940D030C9483000C9419050C948300F8
S11300500C9483000C9483000C9483000C94830010
S11300600C9483000C948300000024272A000025AC
S1130070282B000023262904040404040404040295
S11300800202020202030303030303010204081031
S113009020408001020408102001020408102000FE
S11300A00000070002010000030406000000000035
S11300B000000000650111241FBECFEFD4E0DEBFB5
S11300C0CDBF11E0A0E0B1E0E4E8FBE002C00590A0
S11300D00D92AE31B107D9F711E0AEE1B1E001C044
S11300E01D92AC3BB107E1F710E0C6EBD0E004C0D1
S11300F02297FE010E94BC05C43BD107C9F70E94A8
S11301005E010C94C0050C94000061E080910E0126
S11301100E94080480911401909115010E94A20389
S113012060E080910E010E94080480911601909174
S113013017010E94A20360E071E08EE291E00E9448
S11301408E0160911401709115018EE291E00E947C
S1130150DD020E946A0360931E0170931F01809365
S113016020019093210128EE33E040E050E00E940A
S11301706905C901DA018093220190932301A093B8
S11301802401B09325018A389105A105B105D1F167
S11301908B389105A105B1055CF40097A105B10563
S11301A0C1F088389105A105B10509F058C01AC0FD
S11301B0883B9105A105B105A9F1883C9105A105EC
S11301C0B105E9F180399105A105B10509F047C0F0
S11301D01CC061E080910C010E94080461E08091E0
S11301E0080108C060E0809108010E94080461E0F1
S11301F080910C010E94080460E080910A010E9431
S113020008042DC080E496E026C061E080910C01D2
S11302100E94080460E080910A010E94080487E9B2
S113022093E019C061E080910C010E94080460E031
S113023080910A010E94080480E699E00CC060E005
S113024080910C010E94080461E080910A010E94DF
S1130250080482E796E0909315018093140140917D
S113026022015091230160912401709125018EE2B5
S113027091E00E94CA02089540E855E260E070E00F
S11302808EE291E00E94790161E0809108010E9470
S1130290EA0361E080910A010E94EA0361E080912F
S11302A00C010E94EA0360E0809126010E94EA03A7
S11302B061E080910E010E94EA0308950E94B00358
S11302C00E943C010E948500FDCF8CE191E0909357
S11302D02F0180932E010895862F0E94D80408953B
S11302E00E94100508950E94F10408950E94E004FC
S11302F00895CB01BA010E949F040895DC01ED9199
S1130300FC910190F081E02D09950895DC01ED91B7
S1130310FC910190F081E02D099508950F931F93AE
S1130320CF93DF938C01EB0109C02196D801ED91A5
S1130330FC910190F081E02DC80109956881662344
S1130340A1F7DF91CF911F910F9108950F931F9300
S11303508C01DC01ED91FC910190F081E02D6DE0C8
S11303600995D801ED91FC910190F081E02D6AE0AE
S1130370C80109951F910F9108950F931F938C0144
S1130380DC01ED91FC910190F081E02D0995C8010B
S11303900E94A6011F910F9108950F931F938C0142
S11303A00E948E01C8010E94A6011F910F91089519
S11303B00F931F938C01DC01ED91FC910190F0816E
S11303C0E02D0995C8010E94A6011F910F9108957F
S11303D02F923F924F925F926F927F928F929F9251
S11303E0AF92BF92CF92DF92EF92FF920F931F933F
S11303F0DF93CF93CDB7DEB7A0970FB6F894DEBFE7
S11304000FBECDBF1C016A017B0141155105610579
S1130410710549F4DC01ED91FC910190F081E02D2E
S113042060E3099554C0882499245401422E55242C
S11304306624772401E010E00C0F1D1F080D191D20
S1130440C701B601A30192010E946905F801608306
S11304500894811C911CA11CB11CC701B601A30105
S113046092010E946905C901DA016C017D01C11480
S1130470D104E104F104F1F681E0E82EF12CEC0E54
S1130480FD1EE80CF91C3E010894611C711CD50189
S1130490C4010197A109B1096C01C818D90814C095
S11304A0F601EE0DFF1D60816A3010F4605D01C03D
S11304B0695CD101ED91FC910190F081E02DC101C5
S11304C009950894E108F1086E147F0449F7A09691
S11304D00FB6F894DEBF0FBECDBFCF91DF911F9151
S11304E00F91FF90EF90DF90CF90BF90AF909F90CF
S11304F08F907F906F905F904F903F902F900895D2
S11305002AE00E94E80108950F931F938C010E9432
S11305108002C8010E94A6011F910F910895AB01AA
S113052060E070E00E94800208950F931F938C0195
S1130530AB0160E070E00E948002C8010E94A60145
S11305401F910F910895EF92FF920F931F93CF93F2
S1130550DF93EC017A018B0177FF0FC0E881F98109
S11305600190F081E02D6DE2099510950095F094CD
S1130570E094E11CF11C011D111D2AE0B801A70142
S1130580CE010E94E801DF91CF911F910F91FF905E
S1130590EF9008950F931F938C010E94A302C8014A
S11305A00E94A6011F910F910895AB01662757FD84
S11305B06095762F0E94A30208950F931F938C01D8
S11305C0AB01662757FD6095762F0E94A302C801F0
S11305D00E94A6011F910F910895DC012115310598
S11305E041F4ED91FC910190F081E02D642F099587
S11305F008952A30310519F40E94A30208950E9437
S1130600E80108950F931F938C010E94ED02C80125
S11306100E94A6011F910F9108951F920F920FB689
S11306200F9211242F938F939F93AF93BF93809135
S1130630300190913101A0913201B0913301805089
S1130640904CAF4FBF4F8093300190933101A093F2
S11306503201B093330127C0809130019091310170
S1130660A0913201B091330180589E43A040B04024
S11306708093300190933101A0933201B093330100
S11306808091340190913501A0913601B0913701E8
S11306900196A11DB11D8093340190933501A0935F
S11306A03601B09337018091300190913101A091CE
S11306B03201B091330181589E43A040B04060F6AE
S11306C0BF91AF919F918F912F910F900FBE0F907B
S11306D01F9018958FB7F89420913401309135010B
S11306E040913601509137018FBFB901CA01089575
S11306F0EF92FF920F931F937B018C018FB7F894B5
S11307004091340150913501609136017091370167
S11307108FBF2FB7F8948091340190913501A09147
S11307203601B09137012FBF841B950BA60BB70B75
S11307308E159F05A007B10760F31F910F91FF90DD
S1130740EF900895019759F0FC01EE0FFF1FEE0F93
S1130750FF1F32978FB7F8943197F1F78FBF089541
S1130760789484B5826084BD84B5816084BD85B588
S1130770826085BD85B5816085BDEEE6F0E080814F
S113078081608083E1E8F0E0808182608083808101
S113079081608083E0E8F0E0808181608083E1EB28
S11307A0F0E0808184608083E0EBF0E08081816010
S11307B08083EAE7F0E080818460808380818260C6
S11307C080838081816080838081806880831092AF
S11307D0C1000895282F30E0C90185579F4FFC01BF
S11307E0949129583F4FF9018491882381F0E82F8F
S11307F0F0E0E859FF4FE491F0E0662329F48081AA
S113080090958923808308958081892B808308951E
S1130810482F50E0CA0181569F4FFC012491CA0120
S113082085579F4FFC01949149585F4FFA013491C9
S11308303323C1F1222331F1233021F4809180004C
S11308408F7705C0243031F4809180008F7D8093B0
S1130850800018C0213019F484B58F7704C0223089
S113086021F484B58F7D84BD0DC0263021F48091A0
S1130870B0008F7705C0273029F48091B0008F7DB8
S11308808093B000E32FF0E0E359FF4FE491F0E0F0
S1130890662329F48081909589238083089580813B
S11308A0892B80830895482F50E0CA0181569F4FB9
S11308B0FC012491CA0185579F4FFC01949149582A
S11308C05F4FFA013491332319F420E030E035C04E
S11308D0222331F1233021F4809180008F7705C0E9
S11308E0243031F4809180008F7D8093800018C083
S11308F0213019F484B58F7704C0223021F484B5F3
S11309008F7D84BD0DC0263021F48091B0008F7797
S113091005C0273029F48091B0008F7D8093B0000A
S1130920E32FF0E0EE58FF4FE491F0E0808120E007
S113093030E0892311F021E030E0C9010895EF92FD
S1130940FF920F931F937B018C0122E030E040E083
S113095050E00E948B05205C3D4B404F5F4FCA0125
S1130960B901A80197010E948B05C901DA01019719
S1130970A109B109292F3A2F4B2F552747FD5A9525
S11309800196A11DB11D2093C50081508093C40020
S1130990E1ECF0E0808180618083808188608083E5
S11309A08081806880831F910F91FF90EF9008955C
S11309B0982F8091C00085FFFCCF9093C6000895C6
S11309C0809138019091390180589F4F20913A01CC
S11309D030913B01821B930B60E870E00E94560546
S11309E0089540913A0150913B01809138019091D2
S11309F039018417950719F42FEF3FEF0FC0FA015F
S1130A00E45CFE4F2081CA01019660E870E00E9418
S1130A10560590933B0180933A0130E0C901089553
S1130A2080913A0190913B01909339018093380170
S1130A3008951F920F920FB60F9211242F933F9394
S1130A404F935F936F937F938F939F93AF93BF93D2
S1130A50EF93FF934091C600E0913801F091390182
S1130A60CF01019660E870E00E9456059C018091D8
S1130A703A0190913B012817390739F0E45CFE4FA5
S1130A8040833093390120933801FF91EF91BF9156
S1130A90AF919F918F917F916F915F914F913F9112
S1130AA02F910F900FBE0F901F90189597FB092E52
S1130AB007260AD077FD04D049D006D000201AF4C6
S1130AC0709561957F4F0895F6F7909581959F4FA6
S1130AD00895A1E21A2EAA1BBB1BFD010DC0AA1F7B
S1130AE0BB1FEE1FFF1FA217B307E407F50720F093
S1130AF0A21BB30BE40BF50B661F771F881F991F0E
S1130B001A9469F760957095809590959B01AC0156
S1130B10BD01CF01089597FB092E05260ED057FD80
S1130B2004D0D7DF0AD0001C38F450954095309596
S1130B3021953F4F4F4F5F4F0895F6F7909580955D
S1130B40709561957F4F8F4F9F4F0895AA1BBB1BD4
S1130B5051E107C0AA1FBB1FA617B70710F0A61BB9
S1130B60B70B881F991F5A95A9F780959095BC01DA
S1130B70CD010895EE0FFF1F0590F491E02D099427
S1070B80F894FFCF13
S1130B842050756C73653A000500080009000300E1
S1110B947807A0F640061400000000006C0173
S9030000FC

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,37 @@
int servoPin = 12; // Control pin for servo motor
int pulseCero; //let`s calibrate!
int maxPulse = 2300; // Maximum servo position
int minPulse= -1300; // Minimum servo position
int pulse = 0; // Amount to pulse the servo
long lastPulse = 0; // the time in milliseconds of the last pulse
int refreshTime = 20; // the time needed in between pulses
int analogValue = 0; // the value returned from the analog sensor
int analogPin = 3; // the analog pin that the sensor's on
void setup() {
pinMode(servoPin, OUTPUT); // Set servo pin as an output pin
//pulse = pulseCero; // Set the motor position value to the minimum
Serial.begin(9600);
}
void loop() {
analogValue = analogRead(analogPin); // read the analog input
Serial.print("Analog Value:");
Serial.print (analogValue);
pulse = map(analogValue,0,1023,minPulse,maxPulse); // convert the analog value
// to a range between minPulse
// and maxPulse.
// pulse the servo again if rhe refresh time (20 ms) have passed:
digitalWrite(servoPin, HIGH); // Turn the motor on
delayMicroseconds(pulse); // Length of the pulse sets the motor position
digitalWrite(servoPin, LOW); // Turn the motor off
delayMicroseconds (refreshTime);
Serial.print (" Pulse:");
Serial.println (pulse);
}

View file

@ -0,0 +1,166 @@
// Cross Fading
// This example uses channels 1,2 and 3 to drive an RGB lamp and make it fade from one color to another.
#include "pins_arduino.h"
int sig = 3; // signal
int value = 0;
int valueadd = 3;
byte curr_rgb[3] = {0,0,0};
byte dmxChannel[64];
void setDmxChannel(byte channelID, byte value) {
if (channelID < 64)
dmxChannel[channelID] = value;
}
/* Sends a DMX byte out on a pin. Assumes a 16 MHz clock.
* Disables interrupts, which will disrupt the millis() function if used
* too frequently. */
void shiftDmxOut(int pin, int theByte)
{
int port_to_output[] = {
NOT_A_PORT,
NOT_A_PORT,
_SFR_IO_ADDR(PORTB),
_SFR_IO_ADDR(PORTC),
_SFR_IO_ADDR(PORTD)
};
int portNumber = port_to_output[digitalPinToPort(pin)];
int pinMask = digitalPinToBitMask(pin);
// the first thing we do is to write te pin to high
// it will be the mark between bytes. It may be also
// high from before
_SFR_BYTE(_SFR_IO8(portNumber)) |= pinMask;
delayMicroseconds(10);
// disable interrupts, otherwise the timer 0 overflow interrupt that
// tracks milliseconds will make us delay longer than we want.
cli();
// DMX starts with a start-bit that must always be zero
_SFR_BYTE(_SFR_IO8(portNumber)) &= ~pinMask;
// we need a delay of 4us (then one bit is transfered)
// this seems more stable then using delayMicroseconds
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
for (int i = 0; i < 8; i++)
{
if (theByte & 01)
{
_SFR_BYTE(_SFR_IO8(portNumber)) |= pinMask;
}
else
{
_SFR_BYTE(_SFR_IO8(portNumber)) &= ~pinMask;
}
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
theByte >>= 1;
}
// the last thing we do is to write the pin to high
// it will be the mark between bytes. (this break is have to be between 8 us and 1 sec)
_SFR_BYTE(_SFR_IO8(portNumber)) |= pinMask;
// reenable interrupts.
sei();
}
void processDmx() {
/***** sending the dmx signal *****/
// sending the break (the break can be between 88us and 1sec)
digitalWrite(sig, LOW);
delay(10);
dmxChannel[0] = 0;
for (int count = 0; count <= 512; count++)
{
if (count < 64)
shiftDmxOut(sig, dmxChannel[count]);
else
shiftDmxOut(sig,0);
}
/***** sending the dmx signal end *****/
}
// fade from current colour to given rgb value
// algorithm by David A. Mellis
void fadeTo(byte r, byte g, byte b) {
byte i;
byte p_start[3];
byte p_end[3];
p_start[0] = curr_rgb[0];
p_start[1] = curr_rgb[1];
p_start[2] = curr_rgb[2];
p_end[0] = r;
p_end[1] = g;
p_end[2] = b;
i = 0;
while (i < 255) {
curr_rgb[0] = (p_end[0] - p_start[0]) / 254 * i + p_start[0];
curr_rgb[1] = (p_end[1] - p_start[1]) / 254 * i + p_start[1];
curr_rgb[2] = (p_end[2] - p_start[2]) / 254 * i + p_start[2];
setDmxChannel(1, curr_rgb[0]);
setDmxChannel(2, curr_rgb[1]);
setDmxChannel(3, curr_rgb[2]);
processDmx();
i++;
}
}
void setup()
{
pinMode(sig, OUTPUT);
}
void loop()
{
fadeTo(255,0,0);
delay(500);
fadeTo(0,255,0);
delay(500);
fadeTo(0,0,255);
delay(500);
}

View file

@ -0,0 +1,181 @@
{\rtf1\ansi\deff0\adeflang1025
{\fonttbl{\f0\froman\fprq2\fcharset0 Nimbus Roman No9 L{\*\falt Times New Roman};}{\f1\froman\fprq2\fcharset0 Nimbus Roman No9 L{\*\falt Times New Roman};}{\f2\fswiss\fprq2\fcharset0 Nimbus Sans L{\*\falt Arial};}{\f3\fmodern\fprq1\fcharset0 DejaVu Sans Mono;}{\f4\fnil\fprq2\fcharset0 DejaVu Sans;}}
{\colortbl;\red0\green0\blue0;\red128\green128\blue128;}
{\stylesheet{\s1\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af4\afs24\lang255\ltrch\dbch\af4\langfe255\hich\f0\fs24\lang1034\loch\f0\fs24\lang1034\snext1 Normal;}
{\s2\sb240\sa120\keepn\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\afs28\lang255\ltrch\dbch\langfe255\hich\f2\fs28\lang1034\loch\f2\fs28\lang1034\sbasedon1\snext3 Heading;}
{\s3\sa120\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af4\afs24\lang255\ltrch\dbch\af4\langfe255\hich\f0\fs24\lang1034\loch\f0\fs24\lang1034\sbasedon1\snext3 Body Text;}
{\s4\sa120\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af4\afs24\lang255\ltrch\dbch\af4\langfe255\hich\f0\fs24\lang1034\loch\f0\fs24\lang1034\sbasedon3\snext4 List;}
{\s5\sb120\sa120\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af4\afs24\lang255\ai\ltrch\dbch\af4\langfe255\hich\f0\fs24\lang1034\i\loch\f0\fs24\lang1034\i\sbasedon1\snext5 caption;}
{\s6\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af4\afs24\lang255\ltrch\dbch\af4\langfe255\hich\f0\fs24\lang1034\loch\f0\fs24\lang1034\sbasedon1\snext6 Index;}
{\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034\sbasedon1\snext7 Preformatted Text;}
}
{\info{\author elab}{\creatim\yr2009\mo11\dy4\hr21\min57}{\revtim\yr0\mo0\dy0\hr0\min0}{\printim\yr0\mo0\dy0\hr0\min0}{\comment StarWriter}{\vern6800}}\deftab709
{\*\pgdsctbl
{\pgdsc0\pgdscuse195\pgwsxn11905\pghsxn16837\marglsxn1134\margrsxn1134\margtsxn1134\margbsxn1134\pgdscnxt0 Standard;}}
\paperh16837\paperw11905\margl1134\margr1134\margt1134\margb1134\sectd\sbknone\pgwsxn11905\pghsxn16837\marglsxn1134\margrsxn1134\margtsxn1134\margbsxn1134\ftnbj\ftnstart1\ftnrstcont\ftnnar\aenddoc\aftnrstcont\aftnstart1\aftnnrlc
\pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 // Cross Fading}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 // This example uses channels 1,2 and 3 to drive an RGB lamp and make it fade from one color to another.}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 #include "pins_arduino.h"}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 int sig = 3; // signal}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 int value = 0;}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 int valueadd = 3;}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 byte curr_rgb[3] = \{0,0,0\};}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 byte dmxChannel[64];}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 void setDmxChannel(byte channelID, byte value) \{}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 if (channelID < 64)}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 dmxChannel[channelID] = value;}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 \}}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 /* Sends a DMX byte out on a pin. Assumes a 16 MHz clock.}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 * Disables interrupts, which will disrupt the millis() function if used}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 * too frequently. */}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 void shiftDmxOut(int pin, int theByte)}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 \{}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 int port_to_output[] = \{}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 NOT_A_PORT,}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 NOT_A_PORT,}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 _SFR_IO_ADDR(PORTB),}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 _SFR_IO_ADDR(PORTC),}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 _SFR_IO_ADDR(PORTD)}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 \};}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 int portNumber = port_to_output[digitalPinToPort(pin)];}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 int pinMask = digitalPinToBitMask(pin);}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 // the first thing we do is to write te pin to high}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 // it will be the mark between bytes. It may be also}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 // high from before}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 _SFR_BYTE(_SFR_IO8(portNumber)) |= pinMask;}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 delayMicroseconds(10);}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 // disable interrupts, otherwise the timer 0 overflow interrupt that}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 // tracks milliseconds will make us delay longer than we want.}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 cli();}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 // DMX starts with a start-bit that must always be zero}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 _SFR_BYTE(_SFR_IO8(portNumber)) &= ~pinMask;}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 // we need a delay of 4us (then one bit is transfered)}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 // this seems more stable then using delayMicroseconds}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 asm("nop\\n nop\\n nop\\n nop\\n nop\\n nop\\n nop\\n nop\\n");}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 asm("nop\\n nop\\n nop\\n nop\\n nop\\n nop\\n nop\\n nop\\n");}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 asm("nop\\n nop\\n nop\\n nop\\n nop\\n nop\\n nop\\n nop\\n");}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 asm("nop\\n nop\\n nop\\n nop\\n nop\\n nop\\n nop\\n nop\\n");}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 asm("nop\\n nop\\n nop\\n nop\\n nop\\n nop\\n nop\\n nop\\n");}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 asm("nop\\n nop\\n nop\\n nop\\n nop\\n nop\\n nop\\n nop\\n");}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 for (int i = 0; i < 8; i++)}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 \{}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 if (theByte & 01)}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 \{}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 _SFR_BYTE(_SFR_IO8(portNumber)) |= pinMask;}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 \}}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 else}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 \{}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 _SFR_BYTE(_SFR_IO8(portNumber)) &= ~pinMask;}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 \}}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 asm("nop\\n nop\\n nop\\n nop\\n nop\\n nop\\n nop\\n nop\\n");}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 asm("nop\\n nop\\n nop\\n nop\\n nop\\n nop\\n nop\\n nop\\n");}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 asm("nop\\n nop\\n nop\\n nop\\n nop\\n nop\\n nop\\n nop\\n");}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 asm("nop\\n nop\\n nop\\n nop\\n nop\\n nop\\n nop\\n nop\\n");}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 asm("nop\\n nop\\n nop\\n nop\\n nop\\n nop\\n nop\\n nop\\n");}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 asm("nop\\n nop\\n nop\\n nop\\n nop\\n nop\\n nop\\n nop\\n");}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 theByte >>= 1;}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 \}}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 // the last thing we do is to write the pin to high}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 // it will be the mark between bytes. (this break is have to be between 8 us and 1 sec)}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 _SFR_BYTE(_SFR_IO8(portNumber)) |= pinMask;}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 // reenable interrupts.}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 sei();}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 \}}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 void processDmx() \{}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 /***** sending the dmx signal *****/}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 // sending the break (the break can be between 88us and 1sec)}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 digitalWrite(sig, LOW);}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 delay(10);}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 dmxChannel[0] = 0;}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 for (int count = 0; count <= 512; count++)}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 \{}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 if (count < 64)}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 shiftDmxOut(sig, dmxChannel[count]);}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 else }
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 shiftDmxOut(sig,0);}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 \}}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 /***** sending the dmx signal end *****/}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 \}}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 // fade from current colour to given rgb value}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 // algorithm by David A. Mellis}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 void fadeTo(byte r, byte g, byte b) \{}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 byte i;}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 byte p_start[3];}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 byte p_end[3];}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 p_start[0] = curr_rgb[0];}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 p_start[1] = curr_rgb[1];}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 p_start[2] = curr_rgb[2];}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 p_end[0] = r; }
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 p_end[1] = g; }
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 p_end[2] = b;}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 i = 0;}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 while (i < 255) \{}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 curr_rgb[0] = (p_end[0] - p_start[0]) / 254 * i + p_start[0];}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 curr_rgb[1] = (p_end[1] - p_start[1]) / 254 * i + p_start[1];}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 curr_rgb[2] = (p_end[2] - p_start[2]) / 254 * i + p_start[2];}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 setDmxChannel(1, curr_rgb[0]);}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 setDmxChannel(2, curr_rgb[1]);}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 setDmxChannel(3, curr_rgb[2]);}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 processDmx();}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 i++; }
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 \}}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 \}}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 void setup()}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 \{}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 pinMode(sig, OUTPUT);}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 \}}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 void loop()}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 \{}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 fadeTo(255,0,0);}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 delay(500);}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 fadeTo(0,255,0);}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 delay(500);}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 fadeTo(0,0,255);}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch }{\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 delay(500); }
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034 {\rtlch \ltrch\loch\f3\fs20\lang1034\i0\b0 \}}
\par \pard\plain \ltrpar\s7\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\sa283\rtlch\af3\afs20\lang255\ltrch\dbch\af3\langfe255\hich\f3\fs20\lang1034\loch\f3\fs20\lang1034
\par \pard\plain \ltrpar\s1\cf0{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af4\afs24\lang255\ltrch\dbch\af4\langfe255\hich\f0\fs24\lang1034\loch\f0\fs24\lang1034
\par }

View file

@ -0,0 +1,146 @@
// A simpler Example
/*
*/
#include "pins_arduino.h"
int sig = 5; // signal
int value = 0;
int value1 = 0;
int value2 = 0;
int value3 = 0;
int valueadd = 3;
byte dmxChannel[64];
void setDmxChannel(byte channelID, byte value) {
if (channelID < 64)
dmxChannel[channelID] = value;
}
/* Sends a DMX byte out on a pin. Assumes a 16 MHz clock.
* Disables interrupts, which will disrupt the millis() function if used
* too frequently. */
void shiftDmxOut(int pin, int theByte)
{
int port_to_output[] = {
NOT_A_PORT,
NOT_A_PORT,
_SFR_IO_ADDR(PORTB),
_SFR_IO_ADDR(PORTC),
_SFR_IO_ADDR(PORTD)
};
int portNumber = port_to_output[digitalPinToPort(pin)];
int pinMask = digitalPinToBitMask(pin);
// the first thing we do is to write te pin to high
// it will be the mark between bytes. It may be also
// high from before
_SFR_BYTE(_SFR_IO8(portNumber)) |= pinMask;
delayMicroseconds(10);
// disable interrupts, otherwise the timer 0 overflow interrupt that
// tracks milliseconds will make us delay longer than we want.
cli();
// DMX starts with a start-bit that must always be zero
_SFR_BYTE(_SFR_IO8(portNumber)) &= ~pinMask;
// we need a delay of 4us (then one bit is transfered)
// this seems more stable then using delayMicroseconds
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
for (int i = 0; i < 8; i++)
{
if (theByte & 01)
{
_SFR_BYTE(_SFR_IO8(portNumber)) |= pinMask;
}
else
{
_SFR_BYTE(_SFR_IO8(portNumber)) &= ~pinMask;
}
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
theByte >>= 1;
}
// the last thing we do is to write the pin to high
// it will be the mark between bytes. (this break is have to be between 8 us and 1 sec)
_SFR_BYTE(_SFR_IO8(portNumber)) |= pinMask;
// reenable interrupts.
sei();
}
void processDmx() {
/***** sending the dmx signal *****/
// sending the break (the break can be between 88us and 1sec)
digitalWrite(sig, LOW);
delay(10);
dmxChannel[0] = 0;
for (int count = 0; count <= 64; count++)
{
if (count < 64)
shiftDmxOut(sig, dmxChannel[count]);
else
shiftDmxOut(sig,255);
}
/***** sending the dmx signal end *****/
}
void setup()
{
Serial.begin(115200);
delay(100);
pinMode(sig, OUTPUT);
}
void loop()
{
if (Serial.available()) {
if (value > 0xC8)
{
if (value==0xD9) value1 = Serial.read()*1.2;
if (value==0xDA) value2 = Serial.read()*1.2;
if (value==0xDB) value3 = Serial.read()*1.2;
}
value = Serial.read();
}
setDmxChannel(7,value1);
setDmxChannel(8, value2);
setDmxChannel(9, value3);
processDmx();
}

View file

@ -0,0 +1,165 @@
// A simpler Example
/*
*/
#include "pins_arduino.h"
#include "WProgram.h"
void setDmxChannel(byte channelID, byte value);
void shiftDmxOut(int pin, int theByte);
void processDmx();
void setup();
void loop();
int sig = 5; // signal
int value = 0;
int value1 = 0;
int value2 = 0;
int value3 = 0;
int valueadd = 3;
byte dmxChannel[64];
void setDmxChannel(byte channelID, byte value) {
if (channelID < 64)
dmxChannel[channelID] = value;
}
/* Sends a DMX byte out on a pin. Assumes a 16 MHz clock.
* Disables interrupts, which will disrupt the millis() function if used
* too frequently. */
void shiftDmxOut(int pin, int theByte)
{
int port_to_output[] = {
NOT_A_PORT,
NOT_A_PORT,
_SFR_IO_ADDR(PORTB),
_SFR_IO_ADDR(PORTC),
_SFR_IO_ADDR(PORTD)
};
int portNumber = port_to_output[digitalPinToPort(pin)];
int pinMask = digitalPinToBitMask(pin);
// the first thing we do is to write te pin to high
// it will be the mark between bytes. It may be also
// high from before
_SFR_BYTE(_SFR_IO8(portNumber)) |= pinMask;
delayMicroseconds(10);
// disable interrupts, otherwise the timer 0 overflow interrupt that
// tracks milliseconds will make us delay longer than we want.
cli();
// DMX starts with a start-bit that must always be zero
_SFR_BYTE(_SFR_IO8(portNumber)) &= ~pinMask;
// we need a delay of 4us (then one bit is transfered)
// this seems more stable then using delayMicroseconds
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
for (int i = 0; i < 8; i++)
{
if (theByte & 01)
{
_SFR_BYTE(_SFR_IO8(portNumber)) |= pinMask;
}
else
{
_SFR_BYTE(_SFR_IO8(portNumber)) &= ~pinMask;
}
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
theByte >>= 1;
}
// the last thing we do is to write the pin to high
// it will be the mark between bytes. (this break is have to be between 8 us and 1 sec)
_SFR_BYTE(_SFR_IO8(portNumber)) |= pinMask;
// reenable interrupts.
sei();
}
void processDmx() {
/***** sending the dmx signal *****/
// sending the break (the break can be between 88us and 1sec)
digitalWrite(sig, LOW);
delay(10);
dmxChannel[0] = 0;
for (int count = 0; count <= 64; count++)
{
if (count < 64)
shiftDmxOut(sig, dmxChannel[count]);
else
shiftDmxOut(sig,255);
}
/***** sending the dmx signal end *****/
}
void setup()
{
Serial.begin(115200);
delay(100);
pinMode(sig, OUTPUT);
}
void loop()
{
if (Serial.available()) {
if (value > 0xC8)
{
if (value==0xD9) value1 = Serial.read()*1.2;
if (value==0xDA) value2 = Serial.read()*1.2;
if (value==0xDB) value3 = Serial.read()*1.2;
}
value = Serial.read();
}
setDmxChannel(7,value1);
setDmxChannel(8, value2);
setDmxChannel(9, value3);
processDmx();
}
int main(void)
{
init();
setup();
for (;;)
loop();
return 0;
}

Binary file not shown.

View file

@ -0,0 +1 @@
:00000001FF

Binary file not shown.

View file

@ -0,0 +1,196 @@
:100000000C945B000C9427020C9454020C94830013
:100010000C9483000C9483000C9483000C94830054
:100020000C9483000C9483000C9483000C94830044
:100030000C9483000C9483000C9483000C94830034
:100040000C9481020C9483000C943D040C94830066
:100050000C9483000C9483000C9483000C94830014
:100060000C9483000C948300000024272A000025B0
:10007000282B000023262904040404040404040299
:100080000202020202030303030303010204081035
:100090002040800102040810200102040810200002
:1000A0000000070002010000030406000000000039
:1000B00000000000110211241FBECFEFD4E0DEBF0C
:1000C000CDBF11E0A0E0B1E0E0E1FCE002C00590AE
:1000D0000D92A231B107D9F711E0A2E1B1E001C060
:1000E0001D92A03FB107E1F710E0C6EBD0E004C0DD
:1000F0002297FE010E940206C43BD107C9F70E9465
:100100000A020C9406060C94000040E052EC61E0F8
:1001100070E08AE591E00E94220264E670E080E0EF
:1001200090E00E94F10261E0809100010E9463036F
:100130000895BF92CF92DF92EF92FF920F931F9399
:10014000DF93CF93CDB7DEB72A970FB6F894DEBF13
:100150000FBECDBF6B01DE011196E2E0F1E02AE0B7
:1001600001900D922150E1F79C0189589F4FFC01AD
:10017000849125573F4FF901B490E82FF0E0EE0F3E
:10018000FF1FEC0FFD1F0181128190E2E92EF12C7F
:10019000E00EF11EF80180A18B2980A38AE090E097
:1001A0000E941B03F894F80180A19B2D9095892350
:1001B00080A300000000000000000000000000001C
:1001C000000000000000000000000000000000002F
:1001D000000000000000000000000000000000001F
:1001E000000000000000000000000000000000000F
:1001F00000000000000000000000000000000000FF
:1002000000000000000000000000000000000000EE
:10021000000020E030E0C0FE04C0F70180818B299F
:1002200003C0F70180818923808300000000000063
:1002300000000000000000000000000000000000BE
:1002400000000000000000000000000000000000AE
:10025000000000000000000000000000000000009E
:10026000000000000000000000000000000000008E
:10027000000000000000000000000000000000007E
:10028000000000000000000000002F5F3F4F2830FA
:10029000310519F0D594C794BECFF80180A18B2900
:1002A00080A378942A960FB6F894DEBF0FBECDBF18
:1002B000CF91DF911F910F91FF90EF90DF90CF9042
:1002C000BF900895CF93DF9360E0809100010E947A
:1002D00081036AE070E080E090E00E94F1021092F9
:1002E0001A01C0E0D0E08091000190910101C0347A
:1002F000D10531F0FE01E65EFE4F608170E002C084
:100300006FEF70E00E9499002196C134D10559F732
:10031000DF91CF9108958AE591E00E941F02882322
:1003200009F469C08091120190911301893C9105F3
:100330000CF459C0893D9105C1F48AE591E00E9411
:100340001C02AA2797FDA095BA2FBC01CD010E94DF
:10035000AD042AE939E949E95FE30E9439050E94C1
:100360007A047093150160931401809112019091A9
:1003700013018A3D9105C1F48AE591E00E941C02B7
:10038000AA2797FDA095BA2FBC01CD010E94AD040C
:100390002AE939E949E95FE30E9439050E947A04B4
:1003A00070931701609316018091120190911301CF
:1003B0008B3D9105C1F48AE591E00E941C02AA27B9
:1003C00097FDA095BA2FBC01CD010E94AD042AE98A
:1003D00039E949E95FE30E9439050E947A04709384
:1003E0001901609318018AE591E00E941C02909324
:1003F0001301809312018091140180932101809157
:1004000016018093220180911801809323010E949C
:10041000620108950E9429030E9485000E948B01B9
:10042000FDCF80E191E090935B0180935A010895A4
:10043000862F0E94050408950E941E0408950E94BC
:100440000D040895CB01BA010E94CC0308951F92B8
:100450000F920FB60F9211242F933F934F935F93F8
:100460006F937F938F939F93AF93BF93EF93FF937C
:1004700080915C0190915D01892B29F0E0915C01F4
:10048000F0915D010995FF91EF91BF91AF919F911F
:100490008F917F916F915F914F913F912F910F902D
:1004A0000FBE0F901F9018951F920F920FB60F92CC
:1004B00011242F933F934F935F936F937F938F9369
:1004C0009F93AF93BF93EF93FF9380915E019091C1
:1004D0005F01892B29F0E0915E01F0915F010995A0
:1004E000FF91EF91BF91AF919F918F917F916F910C
:1004F0005F914F913F912F910F900FBE0F901F90E2
:1005000018951F920F920FB60F9211242F938F936D
:100510009F93AF93BF938091600190916101A091EF
:100520006201B09163010196A11DB11D809360012C
:1005300090936101A0936201B09363018091640183
:1005400090916501A0916601B09167018050904C37
:10055000AF4FBF4F8093640190936501A0936601F4
:10056000B093670127C08091640190916501A091CB
:100570006601B091670180589E43A040B0408093CF
:10058000640190936501A0936601B0936701809127
:10059000680190916901A0916A01B0916B01019687
:1005A000A11DB11D8093680190936901A0936A0118
:1005B000B0936B018091640190916501A0916601F7
:1005C000B091670181589E43A040B04060F6BF9152
:1005D000AF919F918F912F910F900FBE0F901F9011
:1005E0001895EF92FF920F931F937B018C018FB7A9
:1005F000F894409168015091690160916A0170918D
:100600006B018FBF2FB7F8948091680190916901B9
:10061000A0916A01B0916B012FBF841B950BA60BB3
:10062000B70BE816F9060A071B0760F71F910F9131
:10063000FF90EF900895019759F0FC01EE0FFF1F16
:10064000EE0FFF1F32978FB7F8943197F1F78FBFF6
:100650000895789484B5826084BD84B5816084BD3A
:1006600085B5826085BD85B5816085BDEEE6F0E02B
:10067000808181608083E1E8F0E080818260808316
:10068000808181608083E0E8F0E080818160808308
:10069000E1EBF0E0808184608083E0EBF0E080813A
:1006A00081608083EAE7F0E08081846080838081DC
:1006B0008260808380818160808380818068808384
:1006C0001092C1000895282F30E0C90185579F4F2F
:1006D000FC01949129583F4FF9018491882381F0BE
:1006E000E82FF0E0E859FF4FE491F0E0662329F4A9
:1006F000808190958923808308958081892B8083D0
:100700000895482F50E0CA0181569F4FFC01249163
:10071000CA0185579F4FFC01949149585F4FFA01D8
:1007200034913323C1F1222331F1233021F480911C
:1007300080008F7705C0243031F4809180008F7D58
:100740008093800018C0213019F484B58F7704C0DD
:10075000223021F484B58F7D84BD0DC0263021F474
:100760008091B0008F7705C0273029F48091B000C8
:100770008F7D8093B000E32FF0E0E359FF4FE491C9
:10078000F0E0662329F48081909589238083089581
:100790008081892B80830895EF92FF920F931F939E
:1007A0007B018C0122E030E040E050E00E94D10566
:1007B000205C3D4B404F5F4FCA01B901A801970132
:1007C0000E94D105C901DA010197A109B109292FB8
:1007D0003A2F4B2F552747FD5A950196A11DB11D64
:1007E0002093C50081508093C400E1ECF0E080814B
:1007F000806180838081886080838081806880833D
:100800001F910F91FF90EF900895982F8091C00055
:1008100085FFFCCF9093C600089580916C01909164
:100820006D0180589F4F20916E0130916F01821BA6
:10083000930B60E870E00E949C05089540916E0162
:1008400050916F0180916C0190916D018417950713
:1008500019F42FEF3FEF0FC0FA01E059FE4F20814E
:10086000CA01019660E870E00E949C0590936F01B8
:1008700080936E0130E0C90108951F920F920FB668
:100880000F9211242F933F934F935F936F937F9316
:100890008F939F93AF93BF93EF93FF934091C600C5
:1008A000E0916C01F0916D01CF01019660E870E07C
:1008B0000E949C059C0180916E0190916F01281708
:1008C000390739F0E059FE4F408330936D01209392
:1008D0006C01FF91EF91BF91AF919F918F917F91AB
:1008E0006F915F914F913F912F910F900FBE0F909D
:1008F0001F90189504D06894B111B5C0089598D090
:1009000088F09F5790F0B92F9927B751A0F0D1F0F8
:10091000660F771F881F991F1AF0BA95C9F712C082
:10092000B13081F09FD0B1E008959CC0672F782F3F
:100930008827B85F39F0B93FCCF3869577956795EE
:10094000B395D9F73EF490958095709561957F4F5A
:100950008F4F9F4F0895E89409C097FB3EF4909500
:100960008095709561957F4F8F4F9F4F9923A9F088
:10097000F92F96E9BB279395F69587957795679517
:10098000B795F111F8CFFAF4BB0F11F460FF1BC05B
:100990006F5F7F4F8F4F9F4F16C0882311F096E9EE
:1009A00011C0772321F09EE8872F762F05C066239C
:1009B00071F096E8862F70E060E02AF09A95660F55
:1009C000771F881FDAF7880F9695879597F908950E
:1009D00097F99F6780E870E060E008959FEF80ECF2
:1009E000089500240A941616170618060906089595
:1009F00000240A9412161306140605060895092EFB
:100A00000394000C11F4882352F0BB0F40F4BF2B69
:100A100011F460FF04C06F5F7F4F8F4F9F4F0895A9
:100A200057FD9058440F551F59F05F3F71F047959F
:100A3000880F97FB991F61F09F3F79F08795089584
:100A4000121613061406551FF2CF4695F1DF08C0A3
:100A5000161617061806991FF1CF869571056105C0
:100A600008940895E894BB2766277727CB0197F968
:100A700008950BD0C4CFB5DF28F0BADF18F0952366
:100A800009F0A6CFABCF1124EECFCADFA0F3959F1C
:100A9000D1F3950F50E0551F629FF001729FBB2765
:100AA000F00DB11D639FAA27F00DB11DAA1F649F11
:100AB0006627B00DA11D661F829F2227B00DA11DC4
:100AC000621F739FB00DA11D621F839FA00D611D4A
:100AD000221F749F3327A00D611D231F849F600D6B
:100AE000211D822F762F6A2F11249F5750408AF0A4
:100AF000E1F088234AF0EE0FFF1FBB1F661F771F30
:100B0000881F91505040A9F79E3F510570F060CF6B
:100B1000AACF5F3FECF3983EDCF386957795679517
:100B2000B795F795E7959F5FC1F7FE2B880F911D4D
:100B30009695879597F9089597FB092E07260AD071
:100B400077FD04D049D006D000201AF47095619545
:100B50007F4F0895F6F7909581959F4F0895A1E2F4
:100B60001A2EAA1BBB1BFD010DC0AA1FBB1FEE1F27
:100B7000FF1FA217B307E407F50720F0A21BB30B72
:100B8000E40BF50B661F771F881F991F1A9469F7EE
:100B900060957095809590959B01AC01BD01CF014A
:100BA000089597FB092E05260ED057FD04D0D7DFF8
:100BB0000AD0001C38F450954095309521953F4F50
:100BC0004F4F5F4F0895F6F790958095709561951A
:100BD0007F4F8F4F9F4F0895AA1BBB1B51E107C04A
:100BE000AA1FBB1FA617B70710F0A61BB70B881FBD
:100BF000991F5A95A9F780959095BC01CD0108954C
:100C0000EE0FFF1F0590F491E02D0994F894FFCFAB
:100C1000050000000000050008000B0000000000B7
:020C20001802B8
:00000001FF

View file

@ -0,0 +1,146 @@
// A simpler Example
/*
*/
#include "pins_arduino.h"
int sig = 5; // signal
int value = 0;
int value1 = 0;
int value2 = 0;
int value3 = 0;
int valueadd = 3;
byte dmxChannel[64];
void setDmxChannel(byte channelID, byte value) {
if (channelID < 64)
dmxChannel[channelID] = value;
}
/* Sends a DMX byte out on a pin. Assumes a 16 MHz clock.
* Disables interrupts, which will disrupt the millis() function if used
* too frequently. */
void shiftDmxOut(int pin, int theByte)
{
int port_to_output[] = {
NOT_A_PORT,
NOT_A_PORT,
_SFR_IO_ADDR(PORTB),
_SFR_IO_ADDR(PORTC),
_SFR_IO_ADDR(PORTD)
};
int portNumber = port_to_output[digitalPinToPort(pin)];
int pinMask = digitalPinToBitMask(pin);
// the first thing we do is to write te pin to high
// it will be the mark between bytes. It may be also
// high from before
_SFR_BYTE(_SFR_IO8(portNumber)) |= pinMask;
delayMicroseconds(10);
// disable interrupts, otherwise the timer 0 overflow interrupt that
// tracks milliseconds will make us delay longer than we want.
cli();
// DMX starts with a start-bit that must always be zero
_SFR_BYTE(_SFR_IO8(portNumber)) &= ~pinMask;
// we need a delay of 4us (then one bit is transfered)
// this seems more stable then using delayMicroseconds
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
for (int i = 0; i < 8; i++)
{
if (theByte & 01)
{
_SFR_BYTE(_SFR_IO8(portNumber)) |= pinMask;
}
else
{
_SFR_BYTE(_SFR_IO8(portNumber)) &= ~pinMask;
}
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
theByte >>= 1;
}
// the last thing we do is to write the pin to high
// it will be the mark between bytes. (this break is have to be between 8 us and 1 sec)
_SFR_BYTE(_SFR_IO8(portNumber)) |= pinMask;
// reenable interrupts.
sei();
}
void processDmx() {
/***** sending the dmx signal *****/
// sending the break (the break can be between 88us and 1sec)
digitalWrite(sig, LOW);
delay(10);
dmxChannel[0] = 0;
for (int count = 0; count <= 64; count++)
{
if (count < 64)
shiftDmxOut(sig, dmxChannel[count]);
else
shiftDmxOut(sig,255);
}
/***** sending the dmx signal end *****/
}
void setup()
{
Serial.begin(115200);
delay(100);
pinMode(sig, OUTPUT);
}
void loop()
{
if (Serial.available()) {
if (value > 0xC8)
{
if (value==0xD9) value1 = Serial.read()*1.2;
if (value==0xDA) value2 = Serial.read()*1.2;
if (value==0xDB) value3 = Serial.read()*1.2;
}
value = Serial.read();
}
setDmxChannel(7,value1);
setDmxChannel(8, value2);
setDmxChannel(9, value3);
processDmx();
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,184 @@
#include "pins_arduino.h"
int sig = 5; // signal
int value = 0;
int value1 = 0;
int value2 = 0;
int value3 = 0;
int i=0;
byte checksum;
byte id=0;
int valueadd = 3;
byte buffer[4];
byte color[256];
byte dmxChannel[64];
void setDmxChannel(byte channelID, byte value) {
if (channelID < 64)
dmxChannel[channelID] = value;
}
/* Sends a DMX byte out on a pin. Assumes a 16 MHz clock.
* Disables interrupts, which will disrupt the millis() function if used
* too frequently. */
void shiftDmxOut(int pin, int theByte)
{
int port_to_output[] = {
NOT_A_PORT,
NOT_A_PORT,
_SFR_IO_ADDR(PORTB),
_SFR_IO_ADDR(PORTC),
_SFR_IO_ADDR(PORTD)
};
int portNumber = port_to_output[digitalPinToPort(pin)];
int pinMask = digitalPinToBitMask(pin);
// the first thing we do is to write te pin to high
// it will be the mark between bytes. It may be also
// high from before
_SFR_BYTE(_SFR_IO8(portNumber)) |= pinMask;
delayMicroseconds(10);
// disable interrupts, otherwise the timer 0 overflow interrupt that
// tracks milliseconds will make us delay longer than we want.
cli();
// DMX starts with a start-bit that must always be zero
_SFR_BYTE(_SFR_IO8(portNumber)) &= ~pinMask;
// we need a delay of 4us (then one bit is transfered)
// this seems more stable then using delayMicroseconds
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
for (int i = 0; i < 8; i++)
{
if (theByte & 01)
{
_SFR_BYTE(_SFR_IO8(portNumber)) |= pinMask;
}
else
{
_SFR_BYTE(_SFR_IO8(portNumber)) &= ~pinMask;
}
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
theByte >>= 1;
}
// the last thing we do is to write the pin to high
// it will be the mark between bytes. (this break is have to be between 8 us and 1 sec)
_SFR_BYTE(_SFR_IO8(portNumber)) |= pinMask;
// reenable interrupts.
sei();
}
void processDmx() {
/***** sending the dmx signal *****/
// sending the break (the break can be between 88us and 1sec)
digitalWrite(sig, LOW);
delay(10);
dmxChannel[0] = 0;
for (int count = 0; count <= 64; count++)
{
if (count < 64)
shiftDmxOut(sig, dmxChannel[count]);
else
shiftDmxOut(sig,0);
}
/***** sending the dmx signal end *****/
}
void setup()
{
Serial.begin(57600);
delay(100);
pinMode(sig, OUTPUT);
}
void loop()
{
if (Serial.available()) {
value = Serial.read();
if (value == 0xD9)
{
while (!Serial.available());
id=Serial.read();
i=0;
while (i<4) {
if (Serial.available()) {
buffer[i]= Serial.read();
i=i+1;
}
}
checksum = (buffer[0]+buffer[1]+buffer[2]);
if ( buffer[3] == checksum ) //CHECKSUM (8 bits menos significativos)
{
if (id==0)
{
color[0] = buffer[0];
color[1] = buffer[1];
color[2] = buffer[2];
}
else
{
color[id*3+1] = buffer[0];
color[id*3+2] = buffer[1];
color[id*3+3] = buffer[2];
}
}
else
{
Serial.print(id ,BYTE);
Serial.print(buffer[0] ,BYTE);
Serial.print(buffer[1] ,BYTE);
Serial.print(buffer[2] ,BYTE);
Serial.print(buffer[3] ,BYTE);
Serial.print(checksum ,BYTE);
}
}
}
if (id==0) for (i=0; i<=2; i++) setDmxChannel(i,color[i]);
else for (i=id*3+1; i<=id*3+3; i++) setDmxChannel(i,color[i]);
/*setDmxChannel(8, value2);
setDmxChannel(9, value3);
setDmxChannel(16,value1); //id 5
setDmxChannel(17, value2);
setDmxChannel(18, value3);*/
processDmx();
}

View file

@ -0,0 +1,203 @@
#include "pins_arduino.h"
#include "WProgram.h"
void setDmxChannel(byte channelID, byte value);
void shiftDmxOut(int pin, int theByte);
void processDmx();
void setup();
void loop();
int sig = 5; // signal
int value = 0;
int value1 = 0;
int value2 = 0;
int value3 = 0;
int i=0;
byte checksum;
byte id=0;
int valueadd = 3;
byte buffer[4];
byte color[256];
byte dmxChannel[64];
void setDmxChannel(byte channelID, byte value) {
if (channelID < 64)
dmxChannel[channelID] = value;
}
/* Sends a DMX byte out on a pin. Assumes a 16 MHz clock.
* Disables interrupts, which will disrupt the millis() function if used
* too frequently. */
void shiftDmxOut(int pin, int theByte)
{
int port_to_output[] = {
NOT_A_PORT,
NOT_A_PORT,
_SFR_IO_ADDR(PORTB),
_SFR_IO_ADDR(PORTC),
_SFR_IO_ADDR(PORTD)
};
int portNumber = port_to_output[digitalPinToPort(pin)];
int pinMask = digitalPinToBitMask(pin);
// the first thing we do is to write te pin to high
// it will be the mark between bytes. It may be also
// high from before
_SFR_BYTE(_SFR_IO8(portNumber)) |= pinMask;
delayMicroseconds(10);
// disable interrupts, otherwise the timer 0 overflow interrupt that
// tracks milliseconds will make us delay longer than we want.
cli();
// DMX starts with a start-bit that must always be zero
_SFR_BYTE(_SFR_IO8(portNumber)) &= ~pinMask;
// we need a delay of 4us (then one bit is transfered)
// this seems more stable then using delayMicroseconds
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
for (int i = 0; i < 8; i++)
{
if (theByte & 01)
{
_SFR_BYTE(_SFR_IO8(portNumber)) |= pinMask;
}
else
{
_SFR_BYTE(_SFR_IO8(portNumber)) &= ~pinMask;
}
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
theByte >>= 1;
}
// the last thing we do is to write the pin to high
// it will be the mark between bytes. (this break is have to be between 8 us and 1 sec)
_SFR_BYTE(_SFR_IO8(portNumber)) |= pinMask;
// reenable interrupts.
sei();
}
void processDmx() {
/***** sending the dmx signal *****/
// sending the break (the break can be between 88us and 1sec)
digitalWrite(sig, LOW);
delay(10);
dmxChannel[0] = 0;
for (int count = 0; count <= 64; count++)
{
if (count < 64)
shiftDmxOut(sig, dmxChannel[count]);
else
shiftDmxOut(sig,0);
}
/***** sending the dmx signal end *****/
}
void setup()
{
Serial.begin(57600);
delay(100);
pinMode(sig, OUTPUT);
}
void loop()
{
if (Serial.available()) {
value = Serial.read();
if (value == 0xD9)
{
while (!Serial.available());
id=Serial.read();
i=0;
while (i<4) {
if (Serial.available()) {
buffer[i]= Serial.read();
i=i+1;
}
}
checksum = (buffer[0]+buffer[1]+buffer[2]);
if ( buffer[3] == checksum ) //CHECKSUM (8 bits menos significativos)
{
if (id==0)
{
color[0] = buffer[0];
color[1] = buffer[1];
color[2] = buffer[2];
}
else
{
color[id*3+1] = buffer[0];
color[id*3+2] = buffer[1];
color[id*3+3] = buffer[2];
}
}
else
{
Serial.print(id ,BYTE);
Serial.print(buffer[0] ,BYTE);
Serial.print(buffer[1] ,BYTE);
Serial.print(buffer[2] ,BYTE);
Serial.print(buffer[3] ,BYTE);
Serial.print(checksum ,BYTE);
}
}
}
if (id==0) for (i=0; i<=2; i++) setDmxChannel(i,color[i]);
else for (i=id*3+1; i<=id*3+3; i++) setDmxChannel(i,color[i]);
/*setDmxChannel(8, value2);
setDmxChannel(9, value3);
setDmxChannel(16,value1); //id 5
setDmxChannel(17, value2);
setDmxChannel(18, value3);*/
processDmx();
}
int main(void)
{
init();
setup();
for (;;)
loop();
return 0;
}

Binary file not shown.

View file

@ -0,0 +1 @@
:00000001FF

Binary file not shown.

View file

@ -0,0 +1,203 @@
:100000000C945B000C947E030C94AB030C94830063
:100010000C9483000C9483000C9483000C94830054
:100020000C9483000C9483000C9483000C94830044
:100030000C9483000C9483000C9483000C94830034
:100040000C94D8030C9483000C9494050C948300B6
:100050000C9483000C9483000C9483000C94830014
:100060000C9483000C948300000024272A000025B0
:10007000282B000023262904040404040404040299
:100080000202020202030303030303010204081035
:100090002040800102040810200102040810200002
:1000A0000000070002010000030406000000000039
:1000B00000000000940211241FBECFEFD4E0DEBF89
:1000C000CDBF11E0A0E0B1E0EAE7FCE002C005909E
:1000D0000D92A231B107D9F712E0A2E1B1E001C05F
:1000E0001D92A23FB107E1F710E0C6EBD0E004C0DB
:1000F0002297FE010E943706C43BD107C9F70E9430
:100100008D020C943B060C94000040E051EE60E040
:1001100070E08CE592E00E94A50264E670E080E069
:1001200090E00E94480461E0809100010E94BA04BE
:100130000895BF92CF92DF92EF92FF920F931F9399
:10014000DF93CF93CDB7DEB72A970FB6F894DEBF13
:100150000FBECDBF6B01DE011196E2E0F1E02AE0B7
:1001600001900D922150E1F79C0189589F4FFC01AD
:10017000849125573F4FF901B490E82FF0E0EE0F3E
:10018000FF1FEC0FFD1F0181128190E2E92EF12C7F
:10019000E00EF11EF80180A18B2980A38AE090E097
:1001A0000E947204F894F80180A19B2D90958923F8
:1001B00080A300000000000000000000000000001C
:1001C000000000000000000000000000000000002F
:1001D000000000000000000000000000000000001F
:1001E000000000000000000000000000000000000F
:1001F00000000000000000000000000000000000FF
:1002000000000000000000000000000000000000EE
:10021000000020E030E0C0FE04C0F70180818B299F
:1002200003C0F70180818923808300000000000063
:1002300000000000000000000000000000000000BE
:1002400000000000000000000000000000000000AE
:10025000000000000000000000000000000000009E
:10026000000000000000000000000000000000008E
:10027000000000000000000000000000000000007E
:10028000000000000000000000002F5F3F4F2830FA
:10029000310519F0D594C794BECFF80180A18B2900
:1002A00080A378942A960FB6F894DEBF0FBECDBF18
:1002B000CF91DF911F910F91FF90EF90DF90CF9042
:1002C000BF900895CF93DF9360E0809100010E947A
:1002D000D8046AE070E080E090E00E944804109248
:1002E0001C02C0E0D0E08091000190910101C03477
:1002F000D10531F0FE01E45EFD4F608170E002C087
:1003000060E070E00E9499002196C134D10559F750
:10031000DF91CF9108950F931F938CE592E00E9497
:10032000A202882309F4ADC08CE592E00E949F02EE
:100330009093130180931201893D910509F0A1C0AA
:100340008CE592E00E94A2028823D1F38CE592E032
:100350000E949F02809317011092150110921401C0
:100360001BC08CE592E00E94A2028823A9F00091B4
:100370001401109115018CE592E00E949F02085E25
:100380001E4FF80180838091140190911501019610
:10039000909315018093140180911401909115019F
:1003A0000497FCF2209118013091190150911A0123
:1003B000832F820F850F8093160190911B0140912E
:1003C00017019817F1F4442339F420931C0130935A
:1003D0001D0150931E0155C0842F90E0FC01EE0FCB
:1003E000FF1FE80FF91FE45EFE4F21833283019661
:1003F000FC01EE0FFF1FE80FF91FE45EFE4F508374
:1004000040C050E060E070E020E030E08CE592E039
:100410000E9469034091180150E060E070E020E024
:1004200030E08CE592E00E9469034091190150E0B0
:1004300060E070E020E030E08CE592E00E9469032B
:1004400040911A0150E060E070E020E030E08CE57F
:1004500092E00E94690340911B0150E060E070E06F
:1004600020E030E08CE592E00E94690340911601A3
:1004700050E060E070E020E030E08CE592E00E9427
:100480006903809117018823D9F410921501109205
:100490001401ACE1B1E080E090E00AC02C91E82FBB
:1004A000803420F4F0E0E45EFD4F20830196119645
:1004B000833091059CF3909315018093140128C01B
:1004C00090E09C01220F331F280F391F2F5F3F4FF1
:1004D00030931501209314010196AC01440F551F70
:1004E000480F591FD901A45EBE4F0BC08C91E22F5B
:1004F000203420F4F0E0E45EFD4F80832F5F3F4F17
:1005000011964217530794F7309315012093140165
:100510000E9462011F910F9108950E9480040E9421
:1005200085000E948B01FDCF80E191E090935D02F8
:1005300080935C020895862F0E945C0508950E94B6
:10054000750508950E9464050895CB01BA010E94C3
:10055000230508952F923F924F925F926F927F9260
:100560008F929F92AF92BF92CF92DF92EF92FF92C3
:100570000F931F93DF93CF93CDB7DEB7A0970FB63E
:10058000F894DEBF0FBECDBF1C016A017B0141158F
:1005900051056105710549F4DC01ED91FC91019073
:1005A000F081E02D60E3099554C08824992454011A
:1005B000422E55246624772401E010E00C0F1D1F05
:1005C000080D191DC701B601A30192010E94E4059F
:1005D000F80160830894811C911CA11CB11CC70107
:1005E000B601A30192010E94E405C901DA016C0180
:1005F0007D01C114D104E104F104F1F681E0E82E9B
:10060000F12CEC0EFD1EE80CF91C3E010894611C57
:10061000711CD501C4010197A109B1096C01C81869
:10062000D90814C0F601EE0DFF1D60816A3010F488
:10063000605D01C0695CD101ED91FC910190F08198
:10064000E02DC10109950894E108F1086E147F04BA
:1006500049F7A0960FB6F894DEBF0FBECDBFCF917D
:10066000DF911F910F91FF90EF90DF90CF90BF909F
:10067000AF909F908F907F906F905F904F903F9042
:100680002F900895EF92FF920F931F93CF93DF93D4
:10069000EC017A018B0177FF0FC0E881F9810190AD
:1006A000F081E02D6DE2099510950095F094E094AD
:1006B000E11CF11C011D111D2AE0B801A701CE01AA
:1006C0000E94AA02DF91CF911F910F91FF90EF90AE
:1006D0000895DC012115310541F4ED91FC91019063
:1006E000F081E02D642F099508952A30310519F421
:1006F0000E94420308950E94AA0208951F920F9239
:100700000FB60F9211242F933F934F935F936F93E4
:100710007F938F939F93AF93BF93EF93FF938091BA
:100720005E0290915F02892B29F0E0915E02F091C8
:100730005F020995FF91EF91BF91AF919F918F91CA
:100740007F916F915F914F913F912F910F900FBECD
:100750000F901F9018951F920F920FB60F921124B1
:100760002F933F934F935F936F937F938F939F93B9
:10077000AF93BF93EF93FF938091600290916102DA
:10078000892B29F0E0916002F09161020995FF91B7
:10079000EF91BF91AF919F918F917F916F915F91F9
:1007A0004F913F912F910F900FBE0F901F90189572
:1007B0001F920F920FB60F9211242F938F939F9336
:1007C000AF93BF938091620290916302A091640203
:1007D000B09165020196A11DB11D809362029093B4
:1007E0006302A0936402B0936502809166029091C7
:1007F0006702A0916802B09169028050904CAF4F9F
:10080000BF4F8093660290936702A0936802B093F3
:10081000690227C08091660290916702A0916802E8
:10082000B091690280589E43A040B0408093660218
:1008300090936702A0936802B093690280916A0264
:1008400090916B02A0916C02B0916D020196A11D76
:10085000B11D80936A0290936B02A0936C02B093D7
:100860006D028091660290916702A0916802B0913A
:10087000690281589E43A040B04060F6BF91AF919D
:100880009F918F912F910F900FBE0F901F901895F1
:10089000EF92FF920F931F937B018C018FB7F89417
:1008A00040916A0250916B0260916C0270916D02EE
:1008B0008FBF2FB7F89480916A0290916B02A0913C
:1008C0006C02B0916D022FBF841B950BA60BB70B6A
:1008D000E816F9060A071B0760F71F910F91FF90B2
:1008E000EF900895019759F0FC01EE0FFF1FEE0FF6
:1008F000FF1F32978FB7F8943197F1F78FBF0895A4
:10090000789484B5826084BD84B5816084BD85B5EA
:10091000826085BD85B5816085BDEEE6F0E08081B1
:1009200081608083E1E8F0E0808182608083808163
:1009300081608083E0E8F0E0808181608083E1EB8A
:10094000F0E0808184608083E0EBF0E08081816072
:100950008083EAE7F0E08081846080838081826028
:100960008083808181608083808180688083109211
:10097000C1000895282F30E0C90185579F4FFC0121
:10098000949129583F4FF9018491882381F0E82FF1
:10099000F0E0E859FF4FE491F0E0662329F480810C
:1009A00090958923808308958081892B8083089581
:1009B000482F50E0CA0181569F4FFC012491CA0183
:1009C00085579F4FFC01949149585F4FFA0134912C
:1009D0003323C1F1222331F1233021F480918000AF
:1009E0008F7705C0243031F4809180008F7D809313
:1009F000800018C0213019F484B58F7704C02230EC
:100A000021F484B58F7D84BD0DC0263021F4809102
:100A1000B0008F7705C0273029F48091B0008F7D1A
:100A20008093B000E32FF0E0E359FF4FE491F0E052
:100A3000662329F48081909589238083089580819D
:100A4000892B80830895EF92FF920F931F937B0170
:100A50008C0122E030E040E050E00E940606205C7D
:100A60003D4B404F5F4FCA01B901A80197010E9459
:100A70000606C901DA010197A109B109292F3A2F08
:100A80004B2F552747FD5A950196A11DB11D209367
:100A9000C50081508093C400E1ECF0E0808180616A
:100AA00080838081886080838081806880831F91BB
:100AB0000F91FF90EF900895982F8091C00085FFCF
:100AC000FCCF9093C600089580916E0290916F02C2
:100AD00080589F4F2091700230917102821B930BBE
:100AE00060E870E00E94D105089540917002509135
:100AF000710280916E0290916F028417950719F42C
:100B00002FEF3FEF0FC0FA01EE58FD4F2081CA01D1
:100B1000019660E870E00E94D10590937102809385
:100B2000700230E0C90108951F920F920FB60F9224
:100B300011242F933F934F935F936F937F938F93E2
:100B40009F93AF93BF93EF93FF934091C600E091C3
:100B50006E02F0916F02CF01019660E870E00E9492
:100B6000D1059C018091700290917102281739077C
:100B700039F0EE58FD4F408330936F0220936E02A0
:100B8000FF91EF91BF91AF919F918F917F916F9165
:100B90005F914F913F912F910F900FBE0F901F903B
:100BA000189597FB092E07260AD077FD04D049D067
:100BB00006D000201AF4709561957F4F0895F6F7DE
:100BC000909581959F4F0895A1E21A2EAA1BBB1BF9
:100BD000FD010DC0AA1FBB1FEE1FFF1FA217B30709
:100BE000E407F50720F0A21BB30BE40BF50B661F1F
:100BF000771F881F991F1A9469F7609570958095E3
:100C000090959B01AC01BD01CF01089597FB092E82
:100C100005260ED057FD04D0D7DF0AD0001C38F4CB
:100C200050954095309521953F4F4F4F5F4F089518
:100C3000F6F790958095709561957F4F8F4F9F4FF8
:100C40000895AA1BBB1B51E107C0AA1FBB1FA61713
:100C5000B70710F0A61BB70B881F991F5A95A9F765
:100C600080959095BC01CD010895EE0FFF1F059072
:0A0C7000F491E02D0994F894FFCFF1
:100C7A00050000000000050008000B00000000004D
:020C8A009B02CB
:00000001FF

View file

@ -0,0 +1,184 @@
#include "pins_arduino.h"
int sig = 5; // signal
int value = 0;
int value1 = 0;
int value2 = 0;
int value3 = 0;
int i=0;
byte checksum;
byte id=0;
int valueadd = 3;
byte buffer[4];
byte color[256];
byte dmxChannel[64];
void setDmxChannel(byte channelID, byte value) {
if (channelID < 64)
dmxChannel[channelID] = value;
}
/* Sends a DMX byte out on a pin. Assumes a 16 MHz clock.
* Disables interrupts, which will disrupt the millis() function if used
* too frequently. */
void shiftDmxOut(int pin, int theByte)
{
int port_to_output[] = {
NOT_A_PORT,
NOT_A_PORT,
_SFR_IO_ADDR(PORTB),
_SFR_IO_ADDR(PORTC),
_SFR_IO_ADDR(PORTD)
};
int portNumber = port_to_output[digitalPinToPort(pin)];
int pinMask = digitalPinToBitMask(pin);
// the first thing we do is to write te pin to high
// it will be the mark between bytes. It may be also
// high from before
_SFR_BYTE(_SFR_IO8(portNumber)) |= pinMask;
delayMicroseconds(10);
// disable interrupts, otherwise the timer 0 overflow interrupt that
// tracks milliseconds will make us delay longer than we want.
cli();
// DMX starts with a start-bit that must always be zero
_SFR_BYTE(_SFR_IO8(portNumber)) &= ~pinMask;
// we need a delay of 4us (then one bit is transfered)
// this seems more stable then using delayMicroseconds
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
for (int i = 0; i < 8; i++)
{
if (theByte & 01)
{
_SFR_BYTE(_SFR_IO8(portNumber)) |= pinMask;
}
else
{
_SFR_BYTE(_SFR_IO8(portNumber)) &= ~pinMask;
}
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
theByte >>= 1;
}
// the last thing we do is to write the pin to high
// it will be the mark between bytes. (this break is have to be between 8 us and 1 sec)
_SFR_BYTE(_SFR_IO8(portNumber)) |= pinMask;
// reenable interrupts.
sei();
}
void processDmx() {
/***** sending the dmx signal *****/
// sending the break (the break can be between 88us and 1sec)
digitalWrite(sig, LOW);
delay(10);
dmxChannel[0] = 0;
for (int count = 0; count <= 64; count++)
{
if (count < 64)
shiftDmxOut(sig, dmxChannel[count]);
else
shiftDmxOut(sig,0);
}
/***** sending the dmx signal end *****/
}
void setup()
{
Serial.begin(57600);
delay(100);
pinMode(sig, OUTPUT);
}
void loop()
{
if (Serial.available()) {
value = Serial.read();
if (value == 0xD9)
{
while (!Serial.available());
id=Serial.read();
i=0;
while (i<4) {
if (Serial.available()) {
buffer[i]= Serial.read();
i=i+1;
}
}
checksum = (buffer[0]+buffer[1]+buffer[2]);
if ( buffer[3] == checksum ) //CHECKSUM (8 bits menos significativos)
{
if (id==0)
{
color[0] = buffer[0];
color[1] = buffer[1];
color[2] = buffer[2];
}
else
{
color[id*3+1] = buffer[0];
color[id*3+2] = buffer[1];
color[id*3+3] = buffer[2];
}
}
else
{
Serial.print(id ,BYTE);
Serial.print(buffer[0] ,BYTE);
Serial.print(buffer[1] ,BYTE);
Serial.print(buffer[2] ,BYTE);
Serial.print(buffer[3] ,BYTE);
Serial.print(checksum ,BYTE);
}
}
}
if (id==0) for (i=0; i<=2; i++) setDmxChannel(i,color[i]);
else for (i=id*3+1; i<=id*3+3; i++) setDmxChannel(i,color[i]);
/*setDmxChannel(8, value2);
setDmxChannel(9, value3);
setDmxChannel(16,value1); //id 5
setDmxChannel(17, value2);
setDmxChannel(18, value3);*/
processDmx();
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,186 @@
#include "pins_arduino.h"
int sig = 8; // signal para mochila
//int sig = 5; // signal para placa integrada
int value = 0;
int value1 = 0;
int value2 = 0;
int value3 = 0;
int i=0;
int e=0;
byte checksum;
byte id=0;
int valueadd = 3;
byte buffer[10];
byte color[256];
byte dmxChannel[64];
void setDmxChannel(byte channelID, byte value) {
if (channelID < 64)
dmxChannel[channelID] = value;
}
/* Sends a DMX byte out on a pin. Assumes a 16 MHz clock.
* Disables interrupts, which will disrupt the millis() function if used
* too frequently. */
void shiftDmxOut(int pin, int theByte)
{
int port_to_output[] = {
NOT_A_PORT,
NOT_A_PORT,
_SFR_IO_ADDR(PORTB),
_SFR_IO_ADDR(PORTC),
_SFR_IO_ADDR(PORTD)
};
int portNumber = port_to_output[digitalPinToPort(pin)];
int pinMask = digitalPinToBitMask(pin);
// the first thing we do is to write te pin to high
// it will be the mark between bytes. It may be also
// high from before
_SFR_BYTE(_SFR_IO8(portNumber)) |= pinMask;
delayMicroseconds(10);
// disable interrupts, otherwise the timer 0 overflow interrupt that
// tracks milliseconds will make us delay longer than we want.
cli();
// DMX starts with a start-bit that must always be zero
_SFR_BYTE(_SFR_IO8(portNumber)) &= ~pinMask;
// we need a delay of 4us (then one bit is transfered)
// this seems more stable then using delayMicroseconds
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
for (int i = 0; i < 8; i++)
{
if (theByte & 01)
{
_SFR_BYTE(_SFR_IO8(portNumber)) |= pinMask;
}
else
{
_SFR_BYTE(_SFR_IO8(portNumber)) &= ~pinMask;
}
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
theByte >>= 1;
}
// the last thing we do is to write the pin to high
// it will be the mark between bytes. (this break is have to be between 8 us and 1 sec)
_SFR_BYTE(_SFR_IO8(portNumber)) |= pinMask;
// reenable interrupts.
sei();
}
void processDmx() {
/***** sending the dmx signal *****/
// sending the break (the break can be between 88us and 1sec)
digitalWrite(sig, LOW);
delayMicroseconds(100);
dmxChannel[0] = 0;
for (int count = 0; count <= 64; count++)
{
if (count < 64)
shiftDmxOut(sig, dmxChannel[count]);
else
shiftDmxOut(sig,0);
}
/***** sending the dmx signal end *****/
}
void setup()
{
Serial.begin(57600);
delay(100);
pinMode(sig, OUTPUT);
}
void loop()
{
if (Serial.available()) {
value = Serial.read();
if ((0xD9 == value)&&(i==0))
{
i=1;
}
else if (i==1)
{
id=value;
i=2;
}
else if ((i>=2)&&(i<6))
{
buffer[i]=value;
i=i+1;
}
if (i==6)
{
i=0;
checksum = (buffer[2]+buffer[3]+buffer[4]);
if ( buffer[5] == checksum ) //CHECKSUM (8 bits menos significativos)
{
if (id==0)
{
color[0] = buffer[2];
color[1] = buffer[3];
color[2] = buffer[4];
}
else
{
color[id*3+1] = buffer[2];
color[id*3+2] = buffer[3];
color[id*3+3] = buffer[4];
}
}
else
{
Serial.print(id ,BYTE);
Serial.print(buffer[2] ,BYTE);
Serial.print(buffer[3] ,BYTE);
Serial.print(buffer[4] ,BYTE);
Serial.print(buffer[5] ,BYTE);
Serial.print(checksum ,BYTE);
}
}
}
if (i==0)
{
if (id==0) for (e=0; e<=2; e++) setDmxChannel(e,color[e]);
else for (e=id*3+1; e<=id*3+3; e++) setDmxChannel(e,color[e]);
processDmx();
}
}

View file

@ -0,0 +1,205 @@
#include "pins_arduino.h"
#include "WProgram.h"
void setDmxChannel(byte channelID, byte value);
void shiftDmxOut(int pin, int theByte);
void processDmx();
void setup();
void loop();
int sig = 8; // signal para mochila
//int sig = 5; // signal para placa integrada
int value = 0;
int value1 = 0;
int value2 = 0;
int value3 = 0;
int i=0;
int e=0;
byte checksum;
byte id=0;
int valueadd = 3;
byte buffer[10];
byte color[256];
byte dmxChannel[64];
void setDmxChannel(byte channelID, byte value) {
if (channelID < 64)
dmxChannel[channelID] = value;
}
/* Sends a DMX byte out on a pin. Assumes a 16 MHz clock.
* Disables interrupts, which will disrupt the millis() function if used
* too frequently. */
void shiftDmxOut(int pin, int theByte)
{
int port_to_output[] = {
NOT_A_PORT,
NOT_A_PORT,
_SFR_IO_ADDR(PORTB),
_SFR_IO_ADDR(PORTC),
_SFR_IO_ADDR(PORTD)
};
int portNumber = port_to_output[digitalPinToPort(pin)];
int pinMask = digitalPinToBitMask(pin);
// the first thing we do is to write te pin to high
// it will be the mark between bytes. It may be also
// high from before
_SFR_BYTE(_SFR_IO8(portNumber)) |= pinMask;
delayMicroseconds(10);
// disable interrupts, otherwise the timer 0 overflow interrupt that
// tracks milliseconds will make us delay longer than we want.
cli();
// DMX starts with a start-bit that must always be zero
_SFR_BYTE(_SFR_IO8(portNumber)) &= ~pinMask;
// we need a delay of 4us (then one bit is transfered)
// this seems more stable then using delayMicroseconds
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
for (int i = 0; i < 8; i++)
{
if (theByte & 01)
{
_SFR_BYTE(_SFR_IO8(portNumber)) |= pinMask;
}
else
{
_SFR_BYTE(_SFR_IO8(portNumber)) &= ~pinMask;
}
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
theByte >>= 1;
}
// the last thing we do is to write the pin to high
// it will be the mark between bytes. (this break is have to be between 8 us and 1 sec)
_SFR_BYTE(_SFR_IO8(portNumber)) |= pinMask;
// reenable interrupts.
sei();
}
void processDmx() {
/***** sending the dmx signal *****/
// sending the break (the break can be between 88us and 1sec)
digitalWrite(sig, LOW);
delayMicroseconds(100);
dmxChannel[0] = 0;
for (int count = 0; count <= 64; count++)
{
if (count < 64)
shiftDmxOut(sig, dmxChannel[count]);
else
shiftDmxOut(sig,0);
}
/***** sending the dmx signal end *****/
}
void setup()
{
Serial.begin(57600);
delay(100);
pinMode(sig, OUTPUT);
}
void loop()
{
if (Serial.available()) {
value = Serial.read();
if ((0xD9 == value)&&(i==0))
{
i=1;
}
else if (i==1)
{
id=value;
i=2;
}
else if ((i>=2)&&(i<6))
{
buffer[i]=value;
i=i+1;
}
if (i==6)
{
i=0;
checksum = (buffer[2]+buffer[3]+buffer[4]);
if ( buffer[5] == checksum ) //CHECKSUM (8 bits menos significativos)
{
if (id==0)
{
color[0] = buffer[2];
color[1] = buffer[3];
color[2] = buffer[4];
}
else
{
color[id*3+1] = buffer[2];
color[id*3+2] = buffer[3];
color[id*3+3] = buffer[4];
}
}
else
{
Serial.print(id ,BYTE);
Serial.print(buffer[2] ,BYTE);
Serial.print(buffer[3] ,BYTE);
Serial.print(buffer[4] ,BYTE);
Serial.print(buffer[5] ,BYTE);
Serial.print(checksum ,BYTE);
}
}
}
if (i==0)
{
if (id==0) for (e=0; e<=2; e++) setDmxChannel(e,color[e]);
else for (e=id*3+1; e<=id*3+3; e++) setDmxChannel(e,color[e]);
processDmx();
}
}
int main(void)
{
init();
setup();
for (;;)
loop();
return 0;
}

Binary file not shown.

View file

@ -0,0 +1 @@
:00000001FF

Binary file not shown.

View file

@ -0,0 +1,203 @@
:100000000C945B000C947F030C94AC030C94830061
:100010000C9483000C9483000C9483000C94830054
:100020000C9483000C9483000C9483000C94830044
:100030000C9483000C9483000C9483000C94830034
:100040000C94D9030C9483000C9495050C948300B4
:100050000C9483000C9483000C9483000C94830014
:100060000C9483000C948300000024272A000025B0
:10007000282B000023262904040404040404040299
:100080000202020202030303030303010204081035
:100090002040800102040810200102040810200002
:1000A0000000070002010000030406000000000039
:1000B00000000000950211241FBECFEFD4E0DEBF88
:1000C000CDBF11E0A0E0B1E0ECE7FCE002C005909C
:1000D0000D92A231B107D9F712E0A2E1B1E001C05F
:1000E0001D92AA3FB107E1F710E0C6EBD0E004C0D3
:1000F0002297FE010E943806C43BD107C9F70E942F
:100100008E020C943C060C94000040E051EE60E03E
:1001100070E084E692E00E94A60264E670E080E06F
:1001200090E00E94490461E0809100010E94BB04BC
:100130000895BF92CF92DF92EF92FF920F931F9399
:10014000DF93CF93CDB7DEB72A970FB6F894DEBF13
:100150000FBECDBF6B01DE011196E2E0F1E02AE0B7
:1001600001900D922150E1F79C0189589F4FFC01AD
:10017000849125573F4FF901B490E82FF0E0EE0F3E
:10018000FF1FEC0FFD1F0181128190E2E92EF12C7F
:10019000E00EF11EF80180A18B2980A38AE090E097
:1001A0000E947304F894F80180A19B2D90958923F7
:1001B00080A300000000000000000000000000001C
:1001C000000000000000000000000000000000002F
:1001D000000000000000000000000000000000001F
:1001E000000000000000000000000000000000000F
:1001F00000000000000000000000000000000000FF
:1002000000000000000000000000000000000000EE
:10021000000020E030E0C0FE04C0F70180818B299F
:1002200003C0F70180818923808300000000000063
:1002300000000000000000000000000000000000BE
:1002400000000000000000000000000000000000AE
:10025000000000000000000000000000000000009E
:10026000000000000000000000000000000000008E
:10027000000000000000000000000000000000007E
:10028000000000000000000000002F5F3F4F2830FA
:10029000310519F0D594C794BECFF80180A18B2900
:1002A00080A378942A960FB6F894DEBF0FBECDBF18
:1002B000CF91DF911F910F91FF90EF90DF90CF9042
:1002C000BF900895CF93DF9360E0809100010E947A
:1002D000D90484E690E00E94730410922402C0E0E6
:1002E000D0E08091000190910101C034D10531F03E
:1002F000FE01EC5DFD4F608170E002C060E070E0E7
:100300000E9499002196C134D10559F7DF91CF9110
:10031000089584E692E00E94A302882309F4ADC008
:1003200084E692E00E94A002AC01909313018093B6
:100330001201893D910549F48091140190911501B4
:10034000892B19F481E090E00BC0209114013091C9
:1003500015012130310549F44093190182E090E004
:1003600090931501809314010EC0C9010297049760
:1003700050F4F901E65EFE4F40832F5F3F4F30930C
:100380001501209314018091140190911501069795
:1003900009F073C0109215011092140120911C01F4
:1003A00030911D0150911E01832F820F850F809384
:1003B000180190911F01409119019817F1F44423FD
:1003C00039F420932401309325015093260155C020
:1003D000842F90E0FC01EE0FFF1FE80FF91FEC5D8A
:1003E000FE4F218332830196FC01EE0FFF1FE80FC1
:1003F000F91FEC5DFE4F508340C050E060E070E0BC
:1004000020E030E084E692E00E946A0340911C0103
:1004100050E060E070E020E030E084E692E00E948E
:100420006A0340911D0150E060E070E020E030E0A0
:1004300084E692E00E946A0340911E0150E060E071
:1004400070E020E030E084E692E00E946A03409190
:100450001F0150E060E070E020E030E084E692E0D0
:100460000E946A034091180150E060E070E020E0D3
:1004700030E084E692E00E946A038091140190913A
:100480001501892B09F049C0809119018823D9F4FD
:100490001092170110921601A4E2B1E080E090E002
:1004A0000AC02C91E82F803420F4F0E0EC5DFD4F81
:1004B000208301961196833091059CF39093170148
:1004C0008093160128C090E09C01220F331F280F53
:1004D000391F2F5F3F4F309317012093160101966C
:1004E000AC01440F551F480F591FD901AC5DBE4FD9
:1004F0000BC08C91E22F203420F4F0E0EC5DFD4F36
:1005000080832F5F3F4F11964217530794F7309324
:100510001701209316010E94620108950E94810430
:100520000E9485000E948901FDCF80E191E09093B7
:100530006502809364020895862F0E945D050895E8
:100540000E94760508950E9465050895CB01BA01C1
:100550000E94240508952F923F924F925F926F92CE
:100560007F928F929F92AF92BF92CF92DF92EF9243
:10057000FF920F931F93DF93CF93CDB7DEB7A09772
:100580000FB6F894DEBF0FBECDBF1C016A017B0120
:10059000411551056105710549F4DC01ED91FC91AE
:1005A0000190F081E02D60E3099554C088249924DE
:1005B0005401422E55246624772401E010E00C0FEC
:1005C0001D1F080D191DC701B601A30192010E944C
:1005D000E505F80160830894811C911CA11CB11CE5
:1005E000C701B601A30192010E94E505C901DA0124
:1005F0006C017D01C114D104E104F104F1F681E044
:10060000E82EF12CEC0EFD1EE80CF91C3E010894BE
:10061000611C711CD501C4010197A109B1096C01CC
:10062000C818D90814C0F601EE0DFF1D60816A30AC
:1006300010F4605D01C0695CD101ED91FC91019005
:10064000F081E02DC10109950894E108F1086E14CC
:100650007F0449F7A0960FB6F894DEBF0FBECDBF5A
:10066000CF91DF911F910F91FF90EF90DF90CF908E
:10067000BF90AF909F908F907F906F905F904F90C2
:100680003F902F900895EF92FF920F931F93CF9377
:10069000DF93EC017A018B0177FF0FC0E881F981CC
:1006A0000190F081E02D6DE2099510950095F09490
:1006B000E094E11CF11C011D111D2AE0B801A70105
:1006C000CE010E94AB02DF91CF911F910F91FF905D
:1006D000EF900895DC012115310541F4ED91FC9175
:1006E0000190F081E02D642F099508952A3031059D
:1006F00019F40E94430308950E94AB0208951F92CB
:100700000F920FB60F9211242F933F934F935F9345
:100710006F937F938F939F93AF93BF93EF93FF93C9
:100720008091660290916702892B29F0E091660220
:10073000F09167020995FF91EF91BF91AF919F9161
:100740008F917F916F915F914F913F912F910F907A
:100750000FBE0F901F9018951F920F920FB60F9219
:1007600011242F933F934F935F936F937F938F93B6
:100770009F93AF93BF93EF93FF9380916802909103
:100780006902892B29F0E0916802F09169020995CC
:10079000FF91EF91BF91AF919F918F917F916F9159
:1007A0005F914F913F912F910F900FBE0F901F902F
:1007B00018951F920F920FB60F9211242F938F93BB
:1007C0009F93AF93BF9380916A0290916B02A09127
:1007D0006C02B0916D020196A11DB11D80936A0259
:1007E00090936B02A0936C02B0936D0280916E02A5
:1007F00090916F02A0917002B09171028050904C64
:10080000AF4FBF4F80936E0290936F02A093700220
:10081000B093710227C080916E0290916F02A091F7
:100820007002B091710280589E43A040B040809306
:100830006E0290936F02A0937002B0937102809148
:10084000720290917302A0917402B09175020196A8
:10085000A11DB11D8093720290937302A093740244
:10086000B093750280916E0290916F02A091700218
:10087000B091710281589E43A040B04060F6BF9194
:10088000AF919F918F912F910F900FBE0F901F905E
:100890001895EF92FF920F931F937B018C018FB7F6
:1008A000F8944091720250917302609174027091B9
:1008B00075028FBF2FB7F8948091720290917302E6
:1008C000A0917402B09175022FBF841B950BA60BEB
:1008D000B70BE816F9060A071B0760F71F910F917F
:1008E000FF90EF900895019759F0FC01EE0FFF1F64
:1008F000EE0FFF1F32978FB7F8943197F1F78FBF44
:100900000895789484B5826084BD84B5816084BD87
:1009100085B5826085BD85B5816085BDEEE6F0E078
:10092000808181608083E1E8F0E080818260808363
:10093000808181608083E0E8F0E080818160808355
:10094000E1EBF0E0808184608083E0EBF0E0808187
:1009500081608083EAE7F0E0808184608083808129
:1009600082608083808181608083808180688083D1
:100970001092C1000895282F30E0C90185579F4F7C
:10098000FC01949129583F4FF9018491882381F00B
:10099000E82FF0E0E859FF4FE491F0E0662329F4F6
:1009A000808190958923808308958081892B80831D
:1009B0000895482F50E0CA0181569F4FFC012491B1
:1009C000CA0185579F4FFC01949149585F4FFA0126
:1009D00034913323C1F1222331F1233021F480916A
:1009E00080008F7705C0243031F4809180008F7DA6
:1009F0008093800018C0213019F484B58F7704C02B
:100A0000223021F484B58F7D84BD0DC0263021F4C1
:100A10008091B0008F7705C0273029F48091B00015
:100A20008F7D8093B000E32FF0E0E359FF4FE49116
:100A3000F0E0662329F480819095892380830895CE
:100A40008081892B80830895EF92FF920F931F93EB
:100A50007B018C0122E030E040E050E00E9407067C
:100A6000205C3D4B404F5F4FCA01B901A80197017F
:100A70000E940706C901DA010197A109B109292FCE
:100A80003A2F4B2F552747FD5A950196A11DB11DB1
:100A90002093C50081508093C400E1ECF0E0808198
:100AA000806180838081886080838081806880838A
:100AB0001F910F91FF90EF900895982F8091C000A3
:100AC00085FFFCCF9093C6000895809176029091A7
:100AD000770280589F4F2091780230917902821BD3
:100AE000930B60E870E00E94D2050895409178026F
:100AF0005091790280917602909177028417950740
:100B000019F42FEF3FEF0FC0FA01E658FD4F208197
:100B1000CA01019660E870E00E94D20590937902C4
:100B20008093780230E0C90108951F920F920FB6AA
:100B30000F9211242F933F934F935F936F937F9363
:100B40008F939F93AF93BF93EF93FF934091C60012
:100B5000E0917602F0917702CF01019660E870E0B3
:100B60000E94D2059C018091780290917902281709
:100B7000390739F0E658FD4F4083309377022093D0
:100B80007602FF91EF91BF91AF919F918F917F91ED
:100B90006F915F914F913F912F910F900FBE0F90EA
:100BA0001F90189597FB092E07260AD077FD04D0D1
:100BB00049D006D000201AF4709561957F4F0895B2
:100BC000F6F7909581959F4F0895A1E21A2EAA1BE2
:100BD000BB1BFD010DC0AA1FBB1FEE1FFF1FA217ED
:100BE000B307E407F50720F0A21BB30BE40BF50BEA
:100BF000661F771F881F991F1A9469F76095709573
:100C0000809590959B01AC01BD01CF01089597FBA4
:100C1000092E05260ED057FD04D0D7DF0AD0001CC0
:100C200038F450954095309521953F4F4F4F5F4F89
:100C30000895F6F790958095709561957F4F8F4F49
:100C40009F4F0895AA1BBB1B51E107C0AA1FBB1FE2
:100C5000A617B70710F0A61BB70B881F991F5A9548
:100C6000A9F780959095BC01CD010895EE0FFF1F67
:0C0C70000590F491E02D0994F894FFCF5A
:100C7C00080000000000050008000B000000000048
:020C8C009C02C8
:00000001FF

View file

@ -0,0 +1,186 @@
#include "pins_arduino.h"
int sig = 8; // signal para mochila
//int sig = 5; // signal para placa integrada
int value = 0;
int value1 = 0;
int value2 = 0;
int value3 = 0;
int i=0;
int e=0;
byte checksum;
byte id=0;
int valueadd = 3;
byte buffer[10];
byte color[256];
byte dmxChannel[64];
void setDmxChannel(byte channelID, byte value) {
if (channelID < 64)
dmxChannel[channelID] = value;
}
/* Sends a DMX byte out on a pin. Assumes a 16 MHz clock.
* Disables interrupts, which will disrupt the millis() function if used
* too frequently. */
void shiftDmxOut(int pin, int theByte)
{
int port_to_output[] = {
NOT_A_PORT,
NOT_A_PORT,
_SFR_IO_ADDR(PORTB),
_SFR_IO_ADDR(PORTC),
_SFR_IO_ADDR(PORTD)
};
int portNumber = port_to_output[digitalPinToPort(pin)];
int pinMask = digitalPinToBitMask(pin);
// the first thing we do is to write te pin to high
// it will be the mark between bytes. It may be also
// high from before
_SFR_BYTE(_SFR_IO8(portNumber)) |= pinMask;
delayMicroseconds(10);
// disable interrupts, otherwise the timer 0 overflow interrupt that
// tracks milliseconds will make us delay longer than we want.
cli();
// DMX starts with a start-bit that must always be zero
_SFR_BYTE(_SFR_IO8(portNumber)) &= ~pinMask;
// we need a delay of 4us (then one bit is transfered)
// this seems more stable then using delayMicroseconds
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
for (int i = 0; i < 8; i++)
{
if (theByte & 01)
{
_SFR_BYTE(_SFR_IO8(portNumber)) |= pinMask;
}
else
{
_SFR_BYTE(_SFR_IO8(portNumber)) &= ~pinMask;
}
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
theByte >>= 1;
}
// the last thing we do is to write the pin to high
// it will be the mark between bytes. (this break is have to be between 8 us and 1 sec)
_SFR_BYTE(_SFR_IO8(portNumber)) |= pinMask;
// reenable interrupts.
sei();
}
void processDmx() {
/***** sending the dmx signal *****/
// sending the break (the break can be between 88us and 1sec)
digitalWrite(sig, LOW);
delayMicroseconds(100);
dmxChannel[0] = 0;
for (int count = 0; count <= 64; count++)
{
if (count < 64)
shiftDmxOut(sig, dmxChannel[count]);
else
shiftDmxOut(sig,0);
}
/***** sending the dmx signal end *****/
}
void setup()
{
Serial.begin(57600);
delay(100);
pinMode(sig, OUTPUT);
}
void loop()
{
if (Serial.available()) {
value = Serial.read();
if ((0xD9 == value)&&(i==0))
{
i=1;
}
else if (i==1)
{
id=value;
i=2;
}
else if ((i>=2)&&(i<6))
{
buffer[i]=value;
i=i+1;
}
if (i==6)
{
i=0;
checksum = (buffer[2]+buffer[3]+buffer[4]);
if ( buffer[5] == checksum ) //CHECKSUM (8 bits menos significativos)
{
if (id==0)
{
color[0] = buffer[2];
color[1] = buffer[3];
color[2] = buffer[4];
}
else
{
color[id*3+1] = buffer[2];
color[id*3+2] = buffer[3];
color[id*3+3] = buffer[4];
}
}
else
{
Serial.print(id ,BYTE);
Serial.print(buffer[2] ,BYTE);
Serial.print(buffer[3] ,BYTE);
Serial.print(buffer[4] ,BYTE);
Serial.print(buffer[5] ,BYTE);
Serial.print(checksum ,BYTE);
}
}
}
if (i==0)
{
if (id==0) for (e=0; e<=2; e++) setDmxChannel(e,color[e]);
else for (e=id*3+1; e<=id*3+3; e++) setDmxChannel(e,color[e]);
processDmx();
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,184 @@
211
#include "pins_arduino.h"
int sig = 8; // signal para mochila
//int sig = 5; // signal para placa integrada
int led1 = 12; // signal para placa integrada
int led2 = 13; // signal para placa integrada
int value = 0;
int value1 = 0;
int value2 = 0;
int value3 = 0;
int i=0;
int e=0;
byte checksum;
byte id=0;
int valueadd = 3;
byte buffer[10];
byte color[256];
byte dmxChannel[64];
void setDmxChannel(byte channelID, byte value) {
if (channelID < 64)
dmxChannel[channelID] = value;
}
/* Sends a DMX byte out on a pin. Assumes a 16 MHz clock.
* Disables interrupts, which will disrupt the millis() function if used
* too frequently. */
void shiftDmxOut(int pin, int theByte)
{
int port_to_output[] = {
NOT_A_PORT,
NOT_A_PORT,
_SFR_IO_ADDR(PORTB),
_SFR_IO_ADDR(PORTC),
_SFR_IO_ADDR(PORTD)
};
int portNumber = port_to_output[digitalPinToPort(pin)];
int pinMask = digitalPinToBitMask(pin);
// the first thing we do is to write te pin to high
// it will be the mark between bytes. It may be also
// high from before
_SFR_BYTE(_SFR_IO8(portNumber)) |= pinMask;
delayMicroseconds(10);
// disable interrupts, otherwise the timer 0 overflow interrupt that
// tracks milliseconds will make us delay longer than we want.
cli();
// DMX starts with a start-bit that must always be zero
_SFR_BYTE(_SFR_IO8(portNumber)) &= ~pinMask;
// we need a delay of 4us (then one bit is transfered)
// this seems more stable then using delayMicroseconds
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
for (int i = 0; i < 8; i++)
{
if (theByte & 01)
{
_SFR_BYTE(_SFR_IO8(portNumber)) |= pinMask;
}
else
{
_SFR_BYTE(_SFR_IO8(portNumber)) &= ~pinMask;
}
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
theByte >>= 1;
}
// the last thing we do is to write the pin to high
// it will be the mark between bytes. (this break is have to be between 8 us and 1 sec)
_SFR_BYTE(_SFR_IO8(portNumber)) |= pinMask;
// reenable interrupts.
sei();
}
void processDmx() {
/***** sending the dmx signal *****/
// sending the break (the break can be between 88us and 1sec)
digitalWrite(sig, LOW);
delayMicroseconds(100);
dmxChannel[0] = 0;
for (int count = 0; count <= 64; count++)
{
if (count < 64)
shiftDmxOut(sig, dmxChannel[count]);
else
shiftDmxOut(sig,0);
}
/***** sending the dmx signal end *****/
}
void setup()
{
Serial.begin(57600);
delay(100);
pinMode(sig, OUTPUT);
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
digitalWrite(led1,LOW);
digitalWrite(led2,HIGH);
}
void loop()
{
digitalWrite(led2,HIGH);
if (Serial.available()) {
value = Serial.read();
if ((0xD9 == value)&&(i==0))
{
i=1;
}
else if (i==1)
{
id=value;
i=2;
}
else if ((i>=2)&&(i<6))
{
buffer[i]=value;
i=i+1;
}
if (i==6)
{
digitalWrite(led2,LOW);
i=0;
checksum = (buffer[2]+buffer[3]+buffer[4]);
if ( buffer[5] == checksum ) //CHECKSUM (8 bits menos significativos)
{
color[id] = buffer[2];
color[id+1] = buffer[3];
color[id+2] = buffer[4];
}
else
{
Serial.print(id ,BYTE);
Serial.print(buffer[2] ,BYTE);
Serial.print(buffer[3] ,BYTE);
Serial.print(buffer[4] ,BYTE);
Serial.print(buffer[5] ,BYTE);
Serial.print(checksum ,BYTE);
}
}
}
if (i==0)
{
for (e=id; e<=id+2; e++) setDmxChannel(e,color[e]);
processDmx();
}
}

View file

@ -0,0 +1,203 @@
#include "pins_arduino.h"
//int sig = 8; // signal para mochila
#include "WProgram.h"
void setDmxChannel(byte channelID, byte value);
void shiftDmxOut(int pin, int theByte);
void processDmx();
void setup();
void loop();
int sig = 5; // signal para placa integrada
int led1 = 12; // signal para placa integrada
int led2 = 13; // signal para placa integrada
int value = 0;
int value1 = 0;
int value2 = 0;
int value3 = 0;
int i=0;
int e=0;
byte checksum;
byte id=0;
int valueadd = 3;
byte buffer[10];
byte color[256];
byte dmxChannel[64];
void setDmxChannel(byte channelID, byte value) {
if (channelID < 64)
dmxChannel[channelID] = value;
}
/* Sends a DMX byte out on a pin. Assumes a 16 MHz clock.
* Disables interrupts, which will disrupt the millis() function if used
* too frequently. */
void shiftDmxOut(int pin, int theByte)
{
int port_to_output[] = {
NOT_A_PORT,
NOT_A_PORT,
_SFR_IO_ADDR(PORTB),
_SFR_IO_ADDR(PORTC),
_SFR_IO_ADDR(PORTD)
};
int portNumber = port_to_output[digitalPinToPort(pin)];
int pinMask = digitalPinToBitMask(pin);
// the first thing we do is to write te pin to high
// it will be the mark between bytes. It may be also
// high from before
_SFR_BYTE(_SFR_IO8(portNumber)) |= pinMask;
delayMicroseconds(10);
// disable interrupts, otherwise the timer 0 overflow interrupt that
// tracks milliseconds will make us delay longer than we want.
cli();
// DMX starts with a start-bit that must always be zero
_SFR_BYTE(_SFR_IO8(portNumber)) &= ~pinMask;
// we need a delay of 4us (then one bit is transfered)
// this seems more stable then using delayMicroseconds
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
for (int i = 0; i < 8; i++)
{
if (theByte & 01)
{
_SFR_BYTE(_SFR_IO8(portNumber)) |= pinMask;
}
else
{
_SFR_BYTE(_SFR_IO8(portNumber)) &= ~pinMask;
}
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
theByte >>= 1;
}
// the last thing we do is to write the pin to high
// it will be the mark between bytes. (this break is have to be between 8 us and 1 sec)
_SFR_BYTE(_SFR_IO8(portNumber)) |= pinMask;
// reenable interrupts.
sei();
}
void processDmx() {
/***** sending the dmx signal *****/
// sending the break (the break can be between 88us and 1sec)
digitalWrite(sig, LOW);
delayMicroseconds(100);
dmxChannel[0] = 0;
for (int count = 0; count <= 64; count++)
{
if (count < 64)
shiftDmxOut(sig, dmxChannel[count]);
else
shiftDmxOut(sig,0);
}
/***** sending the dmx signal end *****/
}
void setup()
{
Serial.begin(57600);
delay(100);
pinMode(sig, OUTPUT);
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
digitalWrite(led1,LOW);
digitalWrite(led2,HIGH);
}
void loop()
{
digitalWrite(led2,HIGH);
if (Serial.available()) {
value = Serial.read();
if ((0xD9 == value)&&(i==0))
{
i=1;
}
else if (i==1)
{
id=value;
i=2;
}
else if ((i>=2)&&(i<6))
{
buffer[i]=value;
i=i+1;
}
if (i==6)
{
digitalWrite(led2,LOW);
i=0;
checksum = (buffer[2]+buffer[3]+buffer[4]);
if ( buffer[5] == checksum ) //CHECKSUM (8 bits menos significativos)
{
color[id] = buffer[2];
color[id+1] = buffer[3];
color[id+2] = buffer[4];
}
else
{
Serial.print(id ,BYTE);
Serial.print(buffer[2] ,BYTE);
Serial.print(buffer[3] ,BYTE);
Serial.print(buffer[4] ,BYTE);
Serial.print(buffer[5] ,BYTE);
Serial.print(checksum ,BYTE);
}
}
}
if (i==0)
{
for (e=id; e<=id+2; e++) setDmxChannel(e,color[e]);
processDmx();
}
}
int main(void)
{
init();
setup();
for (;;)
loop();
return 0;
}

View file

@ -0,0 +1 @@
:00000001FF

Binary file not shown.

View file

@ -0,0 +1,226 @@
:100000000C9462000C948A000C948A000C948A0070
:100010000C948A000C948A000C948A000C948A0038
:100020000C948A000C948A000C948A000C948A0028
:100030000C948A000C948A000C948A000C948A0018
:100040000C9477020C948A000C949E030C948A0002
:100050000C948A000C948A000C948A000C948A00F8
:100060000C948A000C948A000000000024002700F1
:100070002A0000000000250028002B0000000000DE
:1000800023002600290004040404040404040202DA
:100090000202020203030303030301020408102007
:1000A0004080010204081020010204081020000012
:1000B0000007000201000003040600000000000029
:1000C0000000230511241FBECFEFD4E0DEBFCDBF5B
:1000D00011E0A0E0B1E0E6EEFDE002C005900D9277
:1000E000AA31B107D9F713E0AAE1B1E001C01D922E
:1000F000AC30B107E1F710E0C4ECD0E004C02297C7
:10010000FE010E94ED06C23CD107C9F70E947002B1
:100110000C94F1060C94000089EF92E040E051EE5F
:1001200060E070E00E94DB0364E670E080E090E055
:100130000E94BF028091000161E00E943103809122
:10014000020161E00E9431038091040161E00E949C
:1001500031038091020160E00E945103809104010B
:1001600061E00E9451030895BF92CF92DF92EF9217
:10017000FF920F931F93DF93CF93CDB7DEB72A97EC
:100180000FB6F894DEBF0FBECDBF6B01DE01119636
:10019000E6E0F1E02AE001900D922150E1F79C01A8
:1001A0008A579F4FFC01849126563F4FF901B49026
:1001B000E82FF0E0EE0FFF1FEC0FFD1F0181128111
:1001C00090E2E92EF12CE00EF11EF80180A18B29BE
:1001D00080A38AE090E00E94E902F894F80180A1EF
:1001E0009B2D9095892380A3000000000000000053
:1001F00000000000000000000000000000000000FF
:1002000000000000000000000000000000000000EE
:1002100000000000000000000000000000000000DE
:1002200000000000000000000000000000000000CE
:1002300000000000000000000000000000000000BE
:10024000000000000000000020E030E0C0FE04C01C
:10025000F70180818B2903C0F70180818923808386
:10026000000000000000000000000000000000008E
:10027000000000000000000000000000000000007E
:10028000000000000000000000000000000000006E
:10029000000000000000000000000000000000005E
:1002A000000000000000000000000000000000004E
:1002B000000000000000000000000000000000003E
:1002C0002F5F3F4F2830310519F0D594C794BECF2A
:1002D000F80180A18B2980A378942A960FB6F89410
:1002E000DEBF0FBECDBFCF91DF911F910F91FF9069
:1002F000EF90DF90CF90BF900895CF93DF938091E0
:10030000000160E00E94510384E690E00E94E9024F
:1003100010922C02C0E0D0E0809100019091010188
:10032000C034D10531F0FE01E45DFD4F608170E025
:1003300002C060E070E00E94B4002196C134D10593
:1003400059F7DF91CF9108958091040161E00E94F7
:10035000510389EF92E00E94D404882309F49CC0E1
:1003600089EF92E00E94E804AC0190931B01809316
:100370001A01893D910549F480911C0190911D015C
:10038000892B19F481E090E00BC020911C01309181
:100390001D012130310549F44093210182E090E0B4
:1003A00090931D0180931C010EC0C9010297049710
:1003B00050F4F901EE5DFE4F40832F5F3F4F3093C5
:1003C0001D0120931C0180911C0190911D01069735
:1003D00009F062C08091040160E00E945103109214
:1003E0001D0110921C015091240130912501209192
:1003F0002601832F850F820F809320019091270182
:1004000040912101981741F4E42FF0E0E45DFE4FA4
:1004100050833183228340C050E060E070E089EF78
:1004200092E020E030E00E9453064091240150E029
:1004300060E070E089EF92E020E030E00E94530637
:100440004091250150E060E070E089EF92E020E00B
:1004500030E00E9453064091260150E060E070E0D9
:1004600089EF92E020E030E00E945306409127019E
:1004700050E060E070E089EF92E020E030E00E9420
:1004800053064091200150E060E070E089EF92E077
:1004900020E030E00E94530680911C0190911D01E4
:1004A000892BE9F48091210190E0DC01A45DBE4F2D
:1004B000AC014E5F5F4F0AC0E82F2C91803420F4CE
:1004C000F0E0E45DFD4F208301961196481759072F
:1004D0009CF790931F0180931E010E947D01089557
:1004E0000E94F7020E948C000E94A401FDCF1F927F
:1004F0000F920FB60F9211242F933F938F939F93D8
:10050000AF93BF938091700290917102A09172029B
:10051000B0917302309174020196A11DB11D232F79
:100520002D5F2D3720F02D570196A11DB11D209371
:1005300074028093700290937102A0937202B09340
:10054000730280916C0290916D02A0916E02B09145
:100550006F020196A11DB11D80936C0290936D02F4
:10056000A0936E02B0936F02BF91AF919F918F9154
:100570003F912F910F900FBE0F901F901895EF9203
:10058000FF920F931F937B018C018FB7F8944091DA
:1005900070025091710260917202709173028FBF6C
:1005A0002FB7F8948091700290917102A09172021D
:1005B000B09173022FBF841B950BA60BB70BE816E7
:1005C000F9060A071B0760F71F910F91FF90EF9044
:1005D0000895019759F0FC01EE0FFF1FEE0FFF1F6A
:1005E00032978FB7F8943197F1F78FBF08957894C9
:1005F00084B5826084BD84B5816084BD85B5826028
:1006000085BD85B5816085BDEEE6F0E080818160C5
:100610008083E1E8F0E08081826080838081816076
:100620008083E0E8F0E0808181608083E1EBF0E0AE
:10063000808184608083E0EBF0E080818160808352
:10064000EAE7F0E08081846080838081826080833B
:100650008081816080838081806880831092C10066
:100660000895282F30E0C90186569F4FFC019491D0
:100670002A573F4FF9018491882391F0E82FF0E049
:10068000EE0FFF1FE859FF4FA591B491662329F49F
:100690008C91909589238C9308958C91892B8C93C0
:1006A0000895482F50E0CA0182559F4FFC012491C4
:1006B000CA0186569F4FFC0194914A575F4FFA0139
:1006C00034913323D1F1222331F1233021F480916D
:1006D00080008F7705C0243031F4809180008F7DB9
:1006E0008093800018C0213019F484B58F7704C03E
:1006F000223021F484B58F7D84BD0DC0263021F4D5
:100700008091B0008F7705C0273029F48091B00028
:100710008F7D8093B000E32FF0E0EE0FFF1FEE58C7
:10072000FF4FA591B491662329F48C91909589236C
:100730008C9308958C91892B8C9308951F920F921E
:100740000FB60F9211242F933F934F935F936F93A4
:100750007F938F939F93AF93BF93EF93FF934091BA
:10076000C600E091F502F091F602CF01019660E833
:1007700070E00E9487069C018091F7029091F80238
:100780002817390739F0EB58FD4F40833093F602B4
:100790002093F502FF91EF91BF91AF919F918F91BF
:1007A0007F916F915F914F913F912F910F900FBE6D
:1007B0000F901F9018955F926F927F928F929F92E9
:1007C000AF92BF92CF92DF92EF92FF920F931F935F
:1007D000CF93DF93EC013A014B01413482E4580797
:1007E0008FE0680780E078070CF07FC060E874E86D
:1007F0008EE190E0A40193010E94BC06215030409C
:1008000040405040CA01B90122E030E040E050E0F1
:100810000E94BC0659016A01A601950120953095F8
:100820004095509594E0220F331F441F551F9A9511
:10083000D1F760E074E284EF90E00E94BC06CA0148
:10084000B9012FEF30E040E050E00E946806A401BB
:1008500093010E94BC06C90181509F4F18161906CA
:100860001CF4522E5A9403C055245394521A60E03B
:1008700079E08DE390E0A40193010E94BC06215031
:10088000304040405040CA01B90122E030E040E031
:1008900050E00E94BC06209530954095509583E02D
:1008A000220F331F441F551F8A95D1F760E074E271
:1008B00084EF90E00E94BC06CA01B9012FEF30E03E
:1008C00040E050E00E946806A40193010E94BC062B
:1008D000C90181509F4F181619061CF4822F8150B0
:1008E00002C081E0821B851500F5E885F98581E06D
:1008F00090E00A8802C0880F991F0A94E2F780836B
:1009000060E079E08DE390E0A40193010E94BC06D1
:100910002150304040405040CA01B90122E030E04F
:1009200040E050E00E94BC0604C0E885F9851082D2
:100930009501EC81FD813083EE81FF812083EA8582
:10094000FB85208141E050E0CA010E8402C0880F7F
:10095000991F0A94E2F7282B2083EA85FB852081E2
:10096000CA010F8402C0880F991F0A94E2F7282B4E
:100970002083EA85FB858081088802C0440F551FCB
:100980000A94E2F7842B8083DF91CF911F910F911E
:10099000FF90EF90DF90CF90BF90AF909F908F909F
:1009A0007F906F905F900895DC011296ED91FC911D
:1009B0001397E058FF4F8191919180589F4F20816C
:1009C0003181821B930B60E870E00E9487060895D6
:1009D000CF93DF93DC011296ED91FC911397EF0119
:1009E000CE57DF4F48815981E058FF4F8081918178
:1009F000E058F0408417950719F42FEF3FEF0CC033
:100A0000E40FF51F2081CA01019660E870E00E94A2
:100A100087069983888330E0C901DF91CF910895DB
:100A2000FC01A085B18521898C9190E0022E02C045
:100A3000959587950A94E2F780FFF6CF0484F585B3
:100A4000E02D6083089584E191E09093FA02809311
:100A5000F90285E792E09093FC028093FB0285EC1B
:100A600090E09093FE028093FD0284EC90E09093DE
:100A700000038093FF0280EC90E090930203809348
:100A8000010381EC90E0909304038093030386ECD0
:100A900090E0909306038093050384E0809307031E
:100AA00083E08093080387E08093090385E08093C7
:100AB0000A0381E080930B0308950F931F93CF9354
:100AC000DF938C01EB0109C02196D801ED91FC91D7
:100AD0000190F081E02DC801099568816623A1F796
:100AE000DF91CF911F910F910895EF92FF920F9395
:100AF0001F93CF93DF938C017B01EA010CC0D701D8
:100B00006D917D01D801ED91FC910190F081E02D76
:100B1000C80109952197209791F7DF91CF911F91F7
:100B20000F91FF90EF9008952F923F924F925F9216
:100B30006F927F928F929F92AF92BF92CF92DF92ED
:100B4000EF92FF920F931F93DF93CF93CDB7DEB752
:100B5000A0970FB6F894DEBF0FBECDBF1C016A018F
:100B60007B01411551056105710549F4DC01ED91E9
:100B7000FC910190F081E02D60E3099554C0882438
:100B800099245401422E55246624772401E010E074
:100B90000C0F1D1F080D191DC701B601A3019201FD
:100BA0000E949A06F80160830894811C911CA11C84
:100BB000B11CC701B601A30192010E949A06C901A6
:100BC000DA016C017D01C114D104E104F104F1F6F4
:100BD00081E0E82EF12CEC0EFD1EE80CF91C3E0124
:100BE0000894611C711CD501C4010197A109B109C8
:100BF0006C01C818D90814C0F601EE0DFF1D608104
:100C00006A3010F4605D01C0695CD101ED91FC9126
:100C10000190F081E02DC10109950894E108F108E7
:100C20006E147F0449F7A0960FB6F894DEBF0FBE8E
:100C3000CDBFCF91DF911F910F91FF90EF90DF908B
:100C4000CF90BF90AF909F908F907F906F905F906C
:100C50004F903F902F900895EF92FF920F931F9324
:100C6000CF93DF93EC017A018B0177FF0FC0E8810E
:100C7000F9810190F081E02D6DE2099510950095C4
:100C8000F094E094E11CF11C011D111DCE01B8018E
:100C9000A7012AE00E949405DF91CF911F910F9147
:100CA000FF90EF900895DC012115310541F4ED919D
:100CB000FC910190F081E02D642F099508952A3070
:100CC000310519F40E942C0608950E949405089598
:100CD000629FD001739FF001829FE00DF11D649F20
:100CE000E00DF11D929FF00D839FF00D749FF00DAC
:100CF000659FF00D9927729FB00DE11DF91F639F4D
:100D0000B00DE11DF91FBD01CF011124089597FB1E
:100D1000092E07260AD077FD04D049D006D000203E
:100D20001AF4709561957F4F0895F6F79095819527
:100D30009F4F0895A1E21A2EAA1BBB1BFD010DC0F7
:100D4000AA1FBB1FEE1FFF1FA217B307E407F5077B
:100D500020F0A21BB30BE40BF50B661F771F881F57
:100D6000991F1A9469F760957095809590959B01ED
:100D7000AC01BD01CF01089597FB092E05260ED0C9
:100D800057FD04D0D7DF0AD0001C38F450954095A9
:100D9000309521953F4F4F4F5F4F0895F6F790954F
:100DA0008095709561957F4F8F4F9F4F0895AA1B37
:100DB000BB1B51E107C0AA1FBB1FA617B70710F046
:100DC000A61BB70B881F991F5A95A9F78095909578
:100DD000BC01CD010895EE0FFF1F0590F491E02DA9
:060DE0000994F894FFCF16
:100DE60005000C000D0000000000050008000B00C7
:0A0DF6000000000010055D05750502
:00000001FF

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,37 @@
#define rele 10
#define power_on 13
//#define MINUTE 62609
#define MINUTE 10000
unsigned long time=0;
byte flag=0;
int i=1;
int val=0;
void setup() {
Serial.begin(19200); // set up Serial library at 9600 bps
//Serial.println("Empezamos");
pinMode(rele, OUTPUT);
pinMode(power_on, OUTPUT);
digitalWrite(rele,LOW);
digitalWrite(power_on,HIGH);
}
void loop() {
if (Serial.available() > 0)
{
val = Serial.read();
if (val==0x09)
{
Serial.print(val,BYTE);
digitalWrite(rele,HIGH);
}
else if((val==0x0A)||(val==0x00))
{
Serial.print (val,BYTE);
digitalWrite(rele,LOW);
}
}
}

View file

@ -0,0 +1,53 @@
#define rele 10
#define power_on 13
//#define MINUTE 62609
#define MINUTE 10000
#include "WProgram.h"
void setup();
void loop();
unsigned long time=0;
byte flag=0;
int i=1;
int val=0;
void setup() {
Serial.begin(19200); // set up Serial library at 9600 bps
Serial.println("Empezamos");
pinMode(rele, OUTPUT);
pinMode(power_on, OUTPUT);
digitalWrite(rele,LOW);
digitalWrite(power_on,HIGH);
}
void loop() {
if (Serial.available() > 0)
{
val = Serial.read();
if (val==0x09)
{
Serial.print(val,BYTE);
digitalWrite(rele,HIGH);
}
else if((val==0x0A)||(val==0x00))
{
Serial.print (val,BYTE);
digitalWrite(rele,LOW);
}
}
}
int main(void)
{
init();
setup();
for (;;)
loop();
return 0;
}

View file

@ -0,0 +1 @@
:00000001FF

Binary file not shown.

View file

@ -0,0 +1,175 @@
:100000000C9462000C948A000C948A000C948A0070
:100010000C948A000C948A000C948A000C948A0038
:100020000C948A000C948A000C948A000C948A0028
:100030000C948A000C948A000C948A000C948A0018
:100040000C94EB000C948A000C94DA010C948A0056
:100050000C948A000C948A000C948A000C948A00F8
:100060000C948A000C948A000000000024002700F1
:100070002A0000000000250028002B0000000000DE
:1000800023002600290004040404040404040202DA
:100090000202020203030303030301020408102007
:1000A0004080010204081020010204081020000012
:1000B0000007000201000003040600000000000029
:1000C00000005F0311241FBECFEFD8E0DEBFCDBF1D
:1000D00011E0A0E0B1E0E2EBFAE002C005900D9281
:1000E000A431B107D9F711E0A4E1B1E001C01D923C
:1000F000A63BB107E1F710E0C4ECD0E004C02297C2
:10010000FE010E945305C23CD107C9F70E94E400DA
:100110000C9457050C94000083EA91E00E941003B0
:10012000882371F183EA91E00E94240390931501E2
:10013000809314018930910579F483EA91E049E0D4
:1001400050E060E070E020E030E00E94B9048AE016
:1001500061E00E948D0108958A30910511F00097A9
:1001600079F4AC01662757FD6095762F83EA91E01C
:1001700020E030E00E94B9048AE060E00E948D0136
:1001800008950F931F9303EA11E0C80140E05BE478
:1001900060E070E00E941702C80160E071E00E9418
:1001A000EF038AE061E00E946D018DE061E00E9452
:1001B0006D018AE060E00E948D018DE061E00E94A7
:1001C0008D011F910F9108950E9433010E94C1007B
:1001D0000E948C00FDCF1F920F920FB60F92112438
:1001E0002F933F938F939F93AF93BF9380911A0167
:1001F00090911B01A0911C01B0911D0130911E0135
:100200000196A11DB11D232F2D5F2D3720F02D57F5
:100210000196A11DB11D20931E0180931A01909398
:100220001B01A0931C01B0931D01809116019091B8
:100230001701A0911801B09119010196A11DB11DDE
:100240008093160190931701A0931801B0931901A0
:10025000BF91AF919F918F913F912F910F900FBEC2
:100260000F901F901895789484B5826084BD84B5F2
:10027000816084BD85B5826085BD85B5816085BDA1
:10028000EEE6F0E0808181608083E1E8F0E080814B
:1002900082608083808181608083E0E8F0E08081FB
:1002A00081608083E1EBF0E0808184608083E0EB1B
:1002B000F0E0808181608083EAE7F0E08081846003
:1002C000808380818260808380818160808380815F
:1002D000806880831092C1000895282F30E0C90102
:1002E00086569F4FFC0194912A573F4FF901849104
:1002F000882391F0E82FF0E0EE0FFF1FE859FF4F41
:10030000A591B491662329F48C91909589238C93BF
:1003100008958C91892B8C930895482F50E0CA0141
:1003200082559F4FFC012491CA0186569F4FFC01C4
:1003300094914A575F4FFA0134913323D1F122232C
:1003400031F1233021F4809180008F7705C0243073
:1003500031F4809180008F7D8093800018C021301F
:1003600019F484B58F7704C0223021F484B58F7DD1
:1003700084BD0DC0263021F48091B0008F7705C078
:10038000273029F48091B0008F7D8093B000E32F57
:10039000F0E0EE0FFF1FEE58FF4FA591B4916623DA
:1003A00029F48C91909589238C9308958C91892BB5
:1003B0008C9308951F920F920FB60F9211242F93D2
:1003C0003F934F935F936F937F938F939F93AF93DD
:1003D000BF93EF93FF934091C600E0919F01F0918E
:1003E000A001CF01019660E870E00E94ED049C013D
:1003F0008091A1019091A2012817390739F0E15E9F
:10040000FE4F40833093A00120939F01FF91EF9115
:10041000BF91AF919F918F917F916F915F914F911C
:100420003F912F910F900FBE0F901F9018955F92E4
:100430006F927F928F929F92AF92BF92CF92DF92F4
:10044000EF92FF920F931F93CF93DF93EC013A014A
:100450004B01413482E458078FE0680780E0780759
:100460000CF07FC060E874E88EE190E0A401930195
:100470000E9422052150304040405040CA01B9013D
:1004800022E030E040E050E00E94220559016A017C
:10049000A6019501209530954095509594E0220F46
:1004A000331F441F551F9A95D1F760E074E284EF23
:1004B00090E00E942205CA01B9012FEF30E040E030
:1004C00050E00E94CE04A40193010E942205C901BC
:1004D00081509F4F181619061CF4522E5A9403C0CF
:1004E00055245394521A60E079E08DE390E0A40122
:1004F00093010E9422052150304040405040CA01E3
:10050000B90122E030E040E050E00E942205209551
:1005100030954095509583E0220F331F441F551F9F
:100520008A95D1F760E074E284EF90E00E942205A2
:10053000CA01B9012FEF30E040E050E00E94CE0444
:10054000A40193010E942205C90181509F4F1816F2
:1005500019061CF4822F815002C081E0821B851590
:1005600000F5E885F98581E090E00A8802C0880FEF
:10057000991F0A94E2F7808360E079E08DE390E0D0
:10058000A40193010E942205215030404040504078
:10059000CA01B90122E030E040E050E00E942205AB
:1005A00004C0E885F98510829501EC81FD813083D6
:1005B000EE81FF812083EA85FB85208141E050E0C8
:1005C000CA010E8402C0880F991F0A94E2F7282BF3
:1005D0002083EA85FB852081CA010F8402C0880F31
:1005E000991F0A94E2F7282B2083EA85FB858081F6
:1005F000088802C0440F551F0A94E2F7842B8083B9
:10060000DF91CF911F910F91FF90EF90DF90CF90EE
:10061000BF90AF909F908F907F906F905F90089564
:10062000DC011296ED91FC911397E058FF4F8191F8
:10063000919180589F4F20813181821B930B60E8FC
:1006400070E00E94ED040895CF93DF93DC011296D1
:10065000ED91FC911397EF01CE57DF4F48815981FF
:10066000E058FF4F80819181E058F0408417950752
:1006700019F42FEF3FEF0CC0E40FF51F2081CA01E2
:10068000019660E870E00E94ED049983888330E071
:10069000C901DF91CF910895FC01A085B185218921
:1006A0008C9190E0022E02C0959587950A94E2F70E
:1006B00080FFF6CF0484F585E02D608308958EE0F9
:1006C00091E09093A4018093A3018FE191E0909336
:1006D000A6018093A50185EC90E09093A8018093FA
:1006E000A70184EC90E09093AA018093A90180EC8B
:1006F00090E09093AC018093AB0181EC90E09093FB
:10070000AE018093AD0186EC90E09093B0018093B0
:10071000AF0184E08093B10183E08093B20187E070
:100720008093B30185E08093B40181E08093B501AB
:1007300008950F931F93CF93DF938C01EB0109C0B2
:100740002196D801ED91FC910190F081E02DC80136
:10075000099568816623A1F7DF91CF911F910F91D1
:100760000895EF92FF920F931F93CF93DF938C0125
:100770007B01EA010CC0D7016D917D01D801ED919B
:10078000FC910190F081E02DC801099521972097F7
:1007900091F7DF91CF911F910F91FF90EF90089506
:1007A000DC01ED91FC910280F381E02D0995089523
:1007B0000F931F938C01DC01ED91FC910190F0816E
:1007C000E02D6DE00995D801ED91FC910190F0814B
:1007D000E02DC8016AE009951F910F9108950F93CC
:1007E0001F938C010E94D003C8010E94D8031F915F
:1007F0000F9108952F923F924F925F926F927F9246
:100800008F929F92AF92BF92CF92DF92EF92FF9220
:100810000F931F93DF93CF93CDB7DEB7A0970FB69B
:10082000F894DEBF0FBECDBF1C016A017B014115EC
:1008300051056105710549F4DC01ED91FC910190D0
:10084000F081E02D60E3099554C088249924540177
:10085000422E55246624772401E010E00C0F1D1F62
:10086000080D191DC701B601A30192010E940005E0
:10087000F80160830894811C911CA11CB11CC70164
:10088000B601A30192010E940005C901DA016C01C1
:100890007D01C114D104E104F104F1F681E0E82EF8
:1008A000F12CEC0EFD1EE80CF91C3E010894611CB5
:1008B000711CD501C4010197A109B1096C01C818C7
:1008C000D90814C0F601EE0DFF1D60816A3010F4E6
:1008D000605D01C0695CD101ED91FC910190F081F6
:1008E000E02DC10109950894E108F1086E147F0418
:1008F00049F7A0960FB6F894DEBF0FBECDBFCF91DB
:10090000DF911F910F91FF90EF90DF90CF90BF90FC
:10091000AF909F908F907F906F905F904F903F909F
:100920002F900895EF92FF920F931F93CF93DF9331
:10093000EC017A018B0177FF0FC0E881F98101900A
:10094000F081E02D6DE2099510950095F094E0940A
:10095000E11CF11C011D111DCE01B801A7012AE007
:100960000E94FA03DF91CF911F910F91FF90EF90BA
:100970000895DC012115310541F4ED91FC910190C0
:10098000F081E02D642F099508952A30310519F47E
:100990000E94920408950E94FA030895629FD00174
:1009A000739FF001829FE00DF11D649FE00DF11D2A
:1009B000929FF00D839FF00D749FF00D659FF00DD9
:1009C0009927729FB00DE11DF91F639FB00DE11DC6
:1009D000F91FBD01CF011124089597FB092E0726A9
:1009E0000AD077FD04D049D006D000201AF47095C3
:1009F00061957F4F0895F6F7909581959F4F0895E3
:100A0000A1E21A2EAA1BBB1BFD010DC0AA1FBB1F12
:100A1000EE1FFF1FA217B307E407F50720F0A21B84
:100A2000B30BE40BF50B661F771F881F991F1A94F1
:100A300069F760957095809590959B01AC01BD011B
:100A4000CF01089597FB092E05260ED057FD04D03F
:100A5000D7DF0AD0001C38F4509540953095219589
:100A60003F4F4F4F5F4F0895F6F7909580957095E3
:100A700061957F4F8F4F9F4F0895AA1BBB1B51E17C
:100A800007C0AA1FBB1FA617B70710F0A61BB70BFE
:100A9000881F991F5A95A9F780959095BC01CD01A3
:100AA0000895EE0FFF1F0590F491E02D0994F8943E
:020AB000FFCF76
:100AB200456D70657A616D6F7300000000004C0334
:040AC2009903B103E0
:00000001FF

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show more