X-Git-Url: http://git.piffa.net/web?a=blobdiff_plain;f=motors%2Fsimple_motor_transistor_diode_0%2Fsimple_motor_transistor_diode_0.ino;h=c2709f593c554e83fd536ba53c97ff7d1545fc97;hb=cdfee5cfe2f5dd8cd7a8c61cfda797ed096d1d86;hp=5b86a2bf7250152e875423bcaa4812d108c4c251;hpb=5b737b67e45cd2ad8243f968667f75cbcc6cab63;p=sketchbook_andrea diff --git a/motors/simple_motor_transistor_diode_0/simple_motor_transistor_diode_0.ino b/motors/simple_motor_transistor_diode_0/simple_motor_transistor_diode_0.ino index 5b86a2b..c2709f5 100644 --- a/motors/simple_motor_transistor_diode_0/simple_motor_transistor_diode_0.ino +++ b/motors/simple_motor_transistor_diode_0/simple_motor_transistor_diode_0.ino @@ -1,21 +1,27 @@ /* Simple Motor - This sketch use a transistor and a diode - in order to power a 5v ~150mAh directly from the board. - Hard thing is to find a suitable motor! - In order to power a more powerfull motor you need to connect - the transistor to an other power line. +Gestione di un motore DC tramite Arduino. +Elementi richiesti: + +- motore DC a 5v per ~300ma +- transistor NPN 2N2222 +- diodo 1N4001 + + Schemi: + - Breadboard: http://lab.piffa.net/schemi/motor_transistor_diode_bb.png + - Schema circuito: http://lab.piffa.net/schemi/motor_transistor_diode_schem.png + */ -int motorPin = 9; +int motorPin = 9; // Pin tramite cui Arduino controlla il motore void setup() { - pinMode(motorPin, OUTPUT); // We drive the motor just like a LED + pinMode(motorPin, OUTPUT); } void loop() { - digitalWrite(motorPin, HIGH); // Turn on the motor full throttle + digitalWrite(motorPin, HIGH); // Accende il motore a tutta potenza delay(1000); - digitalWrite(motorPin, LOW); // Turn off motor + digitalWrite(motorPin, LOW); // Spegne il motore delay(5000); }