Source
void setup() {
Serial.begin(9600); // go go serial power
pinMode(6, INPUT); // this simulates the two power pins on
pinMode(7, INPUT); // the electric motor, like a virtual motor
pinMode(14, OUTPUT); //logic signal 1
pinMode(15, OUTPUT); //logic signal 2
pinMode(18, OUTPUT); // enable hbridge
digitalWrite(18,LOW); //turn off
digitalWrite(14,HIGH); //send signal1
digitalWrite(15,HIGH); //send signal2
digitalWrite(18,HIGH); //turn on
Serial.println(digitalRead(6)); //get output
Serial.println(digitalRead(7));
Serial.println();
digitalWrite(18,LOW); //turn off
digitalWrite(14,HIGH); //send signal1
digitalWrite(15,LOW); //send signal2
digitalWrite(18,HIGH); //turn on
Serial.println(digitalRead(6)); //get output
Serial.println(digitalRead(7));
Serial.println();
digitalWrite(18,LOW); //turn off
digitalWrite(14,LOW); //send signal1
digitalWrite(15,HIGH); //send signal2
digitalWrite(18,HIGH); //turn on
Serial.println(digitalRead(6)); //get output
Serial.println(digitalRead(7));
Serial.println();
digitalWrite(18,LOW); //turn off
digitalWrite(14,LOW); //send signal1
digitalWrite(15,LOW); //send signal2
digitalWrite(18,HIGH); //turn on
Serial.println(digitalRead(6)); //get output
Serial.println(digitalRead(7));
Serial.println();
}
void loop() {
// Please use common sense when trying 'internet code'.
// I refuse to be held accountable for any
// damages this code may or may not cause.
// Shameless and removable author webpage inclusion:
// http://software.o-o.ro
}
No comments:
Post a Comment