THE ARDUINO HIGH STRIKER (HAU DEN LUKAS)
dear arduinos.
)
i'm working friends since few month on following project: want connect arduino "on 1 side" (input pin 10) light barrier; "other side" connected remote control (out pin 2-9) dvd player. can find on dvd produced 8 chapters every second refers foregoing chapter (that have pairs of chapters: chapter 3 shows modified version of "clean" chapter 2; chapter 5 shows modified version of "clean" chapter 4 etc.). last not least, remote control used control 4 dvd-players of same brand. kind of high striker...as crosses light barrier.
concerning programming work function should control output , array make clear there's pairs of videos and, altogether, 6 pairs).
i can't find error in programming. moreover, arduino starts upload, then, nothing happens.
do see problem hide?
big thanks, stephan
)i'm working friends since few month on following project: want connect arduino "on 1 side" (input pin 10) light barrier; "other side" connected remote control (out pin 2-9) dvd player. can find on dvd produced 8 chapters every second refers foregoing chapter (that have pairs of chapters: chapter 3 shows modified version of "clean" chapter 2; chapter 5 shows modified version of "clean" chapter 4 etc.). last not least, remote control used control 4 dvd-players of same brand. kind of high striker...as crosses light barrier.
concerning programming work function should control output , array make clear there's pairs of videos and, altogether, 6 pairs).
i can't find error in programming. moreover, arduino starts upload, then, nothing happens.
do see problem hide?
big thanks, stephan
code: [select]
code;
int lightbarrierin = 10;
int mystate = 0;
long timer;
long dauernormal = 30000;
long dauergestoert = 30000;
int numberpairs = 4;
int nowvideo;
int remotepins[][2] = {{2,3},
{4,5},
{6,7},
{8,9}};
void setup()
{
serial.begin(9600);
for (int info=0; < numberpairs*2; i++) //
{
pinmode(remotepins [info][0], output);
pinmode(remotepins [info][1], output);
}
}
void loop()
{
switch(mystate)
{
case 0:
nowvideo = random(0, 3);
startvideo(nowvideo, 0); //normal video starts
mystate = 1;
break;
case 1:
if(millis()-dauernormal>timer)
{
mystate = 0;
}
if(digitalread(lightbarrierin)==high)
{
mystate = 2;
}
break;
case 2:
nowvideo = random(0, 3);
startvideo(nowvideo, 1);
mystate = 3; // distorted video starts
break;
case 3:
if(millis()-dauergestoert>timer)
{
mystate = 0; // normal
}
break;
}
}
void startvideo(int pairs, int normalordistorted)
{
digitalwrite(remotepins[pairs][normalordistorted],high);
delay(500);
digitalwrite(remotepins[pairs][normalordistorted],low);
timer = millis();
} code tags added moderator
does refer 1 pin, or two:
pinmode ( remotepins [info][0], output);
my guess remotepins [ x ] [ y ] store 2 values, yes?
i didn't think pinmode assign 2 pins outputs @ 1 time.
maybe try instead set pins outputs:
for ( byte pins = 2; pins<10; pins = pins +1 )
{
pinmode ( pins, output );
}
also, maybe typo in question,
"i want connect arduino "on 1 side" (input pin 12) light barrier;"
but pin10 seems used vs pin12:
int lightbarrierin = 10;
pinmode ( remotepins [info][0], output);
my guess remotepins [ x ] [ y ] store 2 values, yes?
i didn't think pinmode assign 2 pins outputs @ 1 time.
maybe try instead set pins outputs:
for ( byte pins = 2; pins<10; pins = pins +1 )
{
pinmode ( pins, output );
}
also, maybe typo in question,
"i want connect arduino "on 1 side" (input pin 12) light barrier;"
but pin10 seems used vs pin12:
int lightbarrierin = 10;
Arduino Forum > Using Arduino > Programming Questions > THE ARDUINO HIGH STRIKER (HAU DEN LUKAS)
arduino
Comments
Post a Comment