//capacitiv module #define t1 PB12 #define t2 PB13 #define t3 PB14 #define t4 PB15 #define t5 PA8 #define t6 PB11 #define t7 PB10 #define t8 PB0 //not used #define sound PA0 #define plasma PA1 //capacitive controll PB0 not working for this =^.^= #define pruf PB0 //module one #define m1_a PA2 #define m1_b PA3 #define m1_c PA4 #define m1_d PA5 //module two #define m2_a PA6 #define m2_b PA7 #define m2_c PB6 #define m2_d PB5 long allfcount = micros(); long maintime = millis(); int onpress[17]; int zeit1 =0; long zeita =10; //untervallspeed int zeitb =0; //anzeitverlängerung int zeitc =30; //auszeitverlängerung int teiler =1; //emfpindlichkeit int fcount1 =0; int soundi =0; int soundminimum =2; int setled=10; int colorindex2 =0; int setled2 =10; int zeit2=0; int volcount =0; int ka =0; void setup() { pinMode(plasma, OUTPUT); pinMode(pruf, OUTPUT); pinMode(m1_a, OUTPUT); pinMode(m1_b, OUTPUT); pinMode(m1_c, OUTPUT); pinMode(m1_d, OUTPUT); pinMode(m2_a, OUTPUT); pinMode(m2_b, OUTPUT); pinMode(m2_c, OUTPUT); pinMode(m2_d, OUTPUT); pinMode(t1, INPUT); pinMode(t2, INPUT); pinMode(t3, INPUT); pinMode(t4, INPUT); pinMode(t5, INPUT); pinMode(t6, INPUT); pinMode(t7, INPUT); pinMode(t8, INPUT); digitalWrite(m1_c,HIGH); digitalWrite(m1_d,HIGH); // delay( 3000 ); // power-up safety delay } int motor1w=0; int speed1=150; boolean links1=false; int motorway1=0; int motor2w=0; int speed2=150; boolean links2=false; int motorway2=0; void loop() { zeitreise(); istinput(); if (motor1w ==1) {motor1(0,speed1,links1,true);} if (motor1w ==0) {motor1(0,speed1,links1,false);} if (motor1w ==2) {motor1w=0;} if (motorway1 ==0) {links1 =false;} if (motorway1 ==1) {links1 =true;} if (motorway1 ==2) {motorway1=0;} if (motor2w ==1) {motor2(0,speed2,links2,true);} if (motor2w ==0) {motor2(0,speed2,links2,false);} if (motor2w ==2) {motor2w=0;} if (motorway2 ==0) {links2 =false;} if (motorway2 ==1) {links2 =true;} if (motorway2 ==2) {motorway2=0;} if (analogRead(sound) > 10) {soundi = analogRead(sound)-zeitc; }} long motor1time = micros(); int motor1zeit=2; void motor1(int posi,int speedr,boolean links,boolean go) { while ((micros()- motor1time) >= (speedr*10)) { if (go==true && links==true) { motor1zeit++;} if (go==true && links==false) { motor1zeit--;} motor1time = micros(); } if (motor1zeit <=1) {motor1zeit=5;} if (motor1zeit ==2) {digitalWrite(m1_d,HIGH); digitalWrite(m1_c,HIGH); digitalWrite(m1_b,HIGH); digitalWrite(m1_a,LOW);} if (motor1zeit ==3) {digitalWrite(m1_a,HIGH); digitalWrite(m1_d,HIGH); digitalWrite(m1_c,HIGH); digitalWrite(m1_b,LOW);} if (motor1zeit ==4) {digitalWrite(m1_b,HIGH); digitalWrite(m1_a,HIGH); digitalWrite(m1_d,HIGH); digitalWrite(m1_c,LOW);} if (motor1zeit ==5) {digitalWrite(m1_c,HIGH); digitalWrite(m1_b,HIGH); digitalWrite(m1_a,HIGH); digitalWrite(m1_d,LOW);} if (motor1zeit ==6) {motor1zeit=2;}} long motor2time = micros(); int motor2zeit=2; void motor2(int posi2,int speedr2,boolean links2,boolean go2) { while ((micros()- motor2time) >= (speedr2*10)) { if (go2==true && links2==true) { motor2zeit++;} if (go2==true && links2==false) { motor2zeit--;} motor2time = micros(); } if (motor2zeit <=1) {motor2zeit=5;} if (motor2zeit ==2) {digitalWrite(m2_d,HIGH); digitalWrite(m2_c,HIGH); digitalWrite(m2_b,HIGH); digitalWrite(m2_a,LOW);} if (motor2zeit ==3) {digitalWrite(m2_a,HIGH); digitalWrite(m2_d,HIGH); digitalWrite(m2_c,HIGH); digitalWrite(m2_b,LOW);} if (motor2zeit ==4) {digitalWrite(m2_b,HIGH); digitalWrite(m2_a,HIGH); digitalWrite(m2_d,HIGH); digitalWrite(m2_c,LOW);} if (motor2zeit ==5) {digitalWrite(m2_c,HIGH); digitalWrite(m2_b,HIGH); digitalWrite(m2_a,HIGH); digitalWrite(m2_d,LOW);} if (motor2zeit >=6) {motor2zeit=2;}} void istinput(void){ if (zeit1 >=2) { if (digitalRead(t1) == HIGH && onpress[0] ==0) { onpress[0] =1; motor1w++;} //minisound if (onpress[0] == 1) { onpress[1]++;} if (onpress[1] == 2) { if (soundminimum >3) {soundminimum-=1;} digitalWrite(pruf, HIGH );} //tudinge if (onpress[1] >= 15) { onpress[1] =0; onpress[0]=0; digitalWrite(pruf, LOW );} if (digitalRead(t2) == HIGH && onpress[2] ==0) { onpress[2] =1; motorway1++; } if (onpress[2] == 1) { onpress[3]++;} if (onpress[3] == 2) { if (soundminimum <4000) {soundminimum+=1;} digitalWrite(pruf, HIGH ); } //tudinge if (onpress[3] >= 10) { onpress[3] =0; onpress[2]=0; digitalWrite(pruf, LOW );} if (digitalRead(t3) == HIGH && onpress[4] ==0) { onpress[4] =1; speed1-=1; } if (onpress[4] == 1) { onpress[5]++;} if (onpress[5] == 2) { teiler--; digitalWrite(pruf, HIGH );} //tudinge if (onpress[5] >= 3) { onpress[5] =0; onpress[4]=0; digitalWrite(pruf, LOW ); } if (digitalRead(t4) == HIGH && onpress[6] ==0) { onpress[6] =1;speed1+=2; } if (onpress[6] == 1) { onpress[7]++;} if (onpress[7] == 2) { teiler++; digitalWrite(pruf, HIGH );} //tudinge if (onpress[7] >= 3) { onpress[7] =0; onpress[6]=0; digitalWrite(pruf, LOW ); } if (digitalRead(t5) == HIGH && onpress[8] ==0) { onpress[8] =1; motor2w++; } if (onpress[8] == 1) { onpress[9]++;} if (onpress[9] == 2) { zeitb--; digitalWrite(pruf, HIGH );} //tudinge if (onpress[9] >= 15) { onpress[9] =0; onpress[8]=0; digitalWrite(pruf, LOW );} if (digitalRead(t6) == HIGH && onpress[10] ==0) { onpress[10] =1; motorway2++;} if (onpress[10] == 1) { onpress[11]++;} if (onpress[11] == 2) { zeitb++; digitalWrite(pruf, HIGH );} //tudinge if (onpress[11] >= 10) { onpress[11] =0; onpress[10]=0; digitalWrite(pruf, LOW ); } if (digitalRead(t7) == HIGH && onpress[12] ==0) { onpress[12] =1; speed2-=1; } //zeitc -signal if (onpress[12] == 1) { onpress[13]++;} if (onpress[13] == 2) { zeitc-=4; digitalWrite(pruf, HIGH );} //tudinge if (onpress[13] >= 3) { onpress[13] =0; onpress[12]=0; digitalWrite(pruf, LOW ); } if (digitalRead(t8) == HIGH && onpress[14] ==0) { onpress[14] =1; speed2+=1;} if (onpress[14] == 1) { onpress[15]++;} if (onpress[15] == 2) {zeitc+=2; digitalWrite(pruf, HIGH );} //tudinge if (onpress[15] >= 3) { onpress[15] =0; onpress[14]=0; digitalWrite(pruf, LOW ); } zeit1=0; }} void zeitreise(void){ while ((millis()- maintime) >= 10) { zeit1++; zeit2++; ka++; maintime = millis(); } } //just simple step engin testprogramm //programm by marderchen =^.^= /* MMMMMMMM MMMMMMMMEEEEEEEEEEEEEEEEEEEEEE OOOOOOOOO WWWWWWWW WWWWWWWW M:::::::M M:::::::ME::::::::::::::::::::E OO:::::::::OO W::::::W W::::::W M::::::::M M::::::::ME::::::::::::::::::::E OO:::::::::::::OO W::::::W W::::::W M:::::::::M M:::::::::MEE::::::EEEEEEEEE::::EO:::::::OOO:::::::OW::::::W W::::::W M::::::::::M M::::::::::M E:::::E EEEEEEO::::::O O::::::O W:::::W WWWWW W:::::W M:::::::::::M M:::::::::::M E:::::E O:::::O O:::::O W:::::W W:::::W W:::::W M:::::::M::::M M::::M:::::::M E::::::EEEEEEEEEE O:::::O O:::::O W:::::W W:::::::W W:::::W M::::::M M::::M M::::M M::::::M E:::::::::::::::E O:::::O O:::::O W:::::W W:::::::::W W:::::W M::::::M M::::M::::M M::::::M E:::::::::::::::E O:::::O O:::::O W:::::W W:::::W:::::W W:::::W M::::::M M:::::::M M::::::M E::::::EEEEEEEEEE O:::::O O:::::O W:::::W W:::::W W:::::W W:::::W M::::::M M:::::M M::::::M E:::::E O:::::O O:::::O W:::::W:::::W W:::::W:::::W M::::::M MMMMM M::::::M E:::::E EEEEEEO::::::O O::::::O W:::::::::W W:::::::::W M::::::M M::::::MEE::::::EEEEEEEE:::::EO:::::::OOO:::::::O W:::::::W W:::::::W M::::::M M::::::ME::::::::::::::::::::E OO:::::::::::::OO W:::::W W:::::W M::::::M M::::::ME::::::::::::::::::::E OO:::::::::OO W:::W W:::W MMMMMMMM MMMMMMMMEEEEEEEEEEEEEEEEEEEEEE OOOOOOOOO WWW WWW `..`... `...... `.. .. `........`....... `........`........ `.. `.. `.. `.. `.. `.. `.. `.. `.. `.. `.. `.. `.. `.. `.. `.. `.. `.. `.. `.. `...... `. `.. `...... `...... `.. `.. `.. `.. `.. `.. `.. `.. `.. `.. `.. `.. `.. `.. `.. `.. `.. `.. `.. `.. .. `.. `.. `..`........`........ */