Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- AIUTO
- static bool bSTART = 2;
- static bool bSTOP = 3; // pin A0
- const int E1 = 13; // pin 3
- const int E2 = 12; // pin 5
- const int E3 = 11; // pin 6
- int stato = 0;
- int Ingresso;
- int Ingresso1;
- int s;
- /* Ingresso=> 0 1
- */
- const int Trans [21][2] = { 0, 19,
- 1, 19,
- 2, 19,
- 3, 19,
- 4, 19,
- 5, 19,
- 6, 19,
- 7, 19,
- 8, 19,
- 9, 19,
- 10, 19,
- 11, 19,
- 12, 19,
- 13, 19,
- 14, 19,
- 15, 19,
- 16, 19,
- 17, 19,
- 18, 19,
- 19, 20,
- 20, 19
- };
- /* R G V T[ms] */
- const int on[18][4] = { 1, 0, 0, 5000,
- 0, 1, 0, 5000,
- 0, 0, 1, 5000,
- 0, 0, 0, 3000,
- 0, 0, 1, 5000,
- 0, 1, 0, 5000,
- 1, 0, 0, 5000,
- 0, 0, 0, 2000,
- 1, 1, 1, 3000,
- 0, 0, 0, 2000,
- 1, 1, 1, 3000,
- 0, 0, 0, 2000,
- 1, 1, 1, 3000,
- 0, 0, 0, 2000,
- 1, 1, 1, 3000,
- 0, 0, 0, 2000,
- 1, 1, 1, 3000,
- 0, 0, 0, 2000
- };
- const int off [1][4] = { 0, 0, 0, 1000000000};
- void setup() {
- // Serial.begin(9600);
- pinMode(bSTART, INPUT_PULLUP);
- pinMode(bSTOP, INPUT_PULLUP); // A0 come ingresso digitale con Pull-up
- pinMode(E1, OUTPUT);
- pinMode(E2, OUTPUT);
- pinMode(E3, OUTPUT);
- }
- void loop() {
- Ingresso1 = digitalRead(bSTOP);
- Ingresso = digitalRead(bSTART);
- if (Ingresso == true)
- {
- delay(on[stato][3]);
- stato = Trans[stato][Ingresso];
- digitalWrite(E1, on[s][0]);
- digitalWrite(E2, on[s][1]);
- digitalWrite(E3, on[s][2]);
- }
- else
- {
- }
- if (Ingresso1 == true)
- {
- delay(off[stato][3]);
- stato = Trans[stato][Ingresso];
- digitalWrite(E1, off[s][0]);
- digitalWrite(E2, off[s][1]);
- digitalWrite(E3, off[s][2]);
- }
- else
- {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement