i trying build simple circuit in dc motor controlled spdt slide switch. programme seems fine , can run - trouble is, can't switch control motor switching on , off. clues? i'm doing stupid! thanks.
int switcha = 7;
int motora = 2;
void setup(){
pinmode(switcha,input);
pinmode(motora,output);
}
void loop(){
if(switcha,high){
digitalwrite(motora,high);
delay (1000);
digitalwrite(motora,low);
delay(2000);
}
else{
digitalwrite(motora,low);
}
}
https://123d.circuits.io/circuits/1199570-int-2-2013-q3/edit
hopefully link takes 123d simulation circuit.
debs
int switcha = 7;
int motora = 2;
void setup(){
pinmode(switcha,input);
pinmode(motora,output);
}
void loop(){
if(switcha,high){
digitalwrite(motora,high);
delay (1000);
digitalwrite(motora,low);
delay(2000);
}
else{
digitalwrite(motora,low);
}
}
https://123d.circuits.io/circuits/1199570-int-2-2013-q3/edit
hopefully link takes 123d simulation circuit.
debs
don't connect motor directly arduino pin.
that damage pin and/or arduino.
pins rated 20ma (40ma absolute max).
motors should switched suitable resistor/transitor circuit emf diode.
it seems have connected 9volt battery arduino's 5volt pin.
that smoke arduino.
connect switch input pin , ground. no resistor.
enable internal pullup resistor in pinmode.
https://www.arduino.cc/en/reference/pinmode
read this.
https://learn.adafruit.com/adafruit-arduino-lesson-13-dc-motors/transistors
leo..
that damage pin and/or arduino.
pins rated 20ma (40ma absolute max).
motors should switched suitable resistor/transitor circuit emf diode.
it seems have connected 9volt battery arduino's 5volt pin.
that smoke arduino.
connect switch input pin , ground. no resistor.
enable internal pullup resistor in pinmode.
https://www.arduino.cc/en/reference/pinmode
read this.
https://learn.adafruit.com/adafruit-arduino-lesson-13-dc-motors/transistors
leo..
Arduino Forum > Using Arduino > Motors, Mechanics, and Power (Moderator: fabioc84) > Stuck with simple motor circuit
arduino
Comments
Post a Comment