X-Git-Url: http://git.piffa.net/web?a=blobdiff_plain;f=motors%2Fsimple_motor_PWM_potenziometer_transistor_diode_2%2Fsimple_motor_PWM_potenziometer_transistor_diode_2.ino;h=9a43bcd604aa527faf083a30222028741e634b81;hb=51f324396aad33efa1b0218ffee334a1f7d7c084;hp=54a87ed86401bb709cbdf309073469bd5f37af50;hpb=5b737b67e45cd2ad8243f968667f75cbcc6cab63;p=sketchbook_andrea diff --git a/motors/simple_motor_PWM_potenziometer_transistor_diode_2/simple_motor_PWM_potenziometer_transistor_diode_2.ino b/motors/simple_motor_PWM_potenziometer_transistor_diode_2/simple_motor_PWM_potenziometer_transistor_diode_2.ino index 54a87ed..9a43bcd 100644 --- a/motors/simple_motor_PWM_potenziometer_transistor_diode_2/simple_motor_PWM_potenziometer_transistor_diode_2.ino +++ b/motors/simple_motor_PWM_potenziometer_transistor_diode_2/simple_motor_PWM_potenziometer_transistor_diode_2.ino @@ -1,15 +1,13 @@ /* - Simple Motor with variable spped from pot input + Simple Motor : Potenziometro - This sketch use a transistor and a diode - in order to poer a 5v ~150mAh directly from the board. - Hard thing is to find a suitable motor! + Motore DC con variazione della velocita' impostata + tramite un potenziometro 10k ohms - This version uses a pot as throttle control, - serial for debuggin. + Schema: http://lab.piffa.net/schemi/motor_pot_bb.png */ -const int analogInPin = A0; +const int analogInPin = A0; // Pin a cui e' collegato il potenziometro const int motorPin = 9; int potValue = 0; @@ -22,20 +20,24 @@ void setup() { } void loop() { potValue = analogRead(analogInPin); - motValue = potValue / 4 ; // Simple mapping 1024 -> 255 + motValue = potValue / 4 ; //mappatura 1024 -> 255 - analogWrite(motorPin,motValue); // Change the PWM speed of the motor + analogWrite(motorPin,motValue); // Imposta la velocita' del motore Serial.print("Pot value = " ); Serial.print(potValue); - Serial.print("\t Motor speed = "); + Serial.print("\t Motore velocita' = "); Serial.println(motValue); - delay(3); // Pause, helps to stabilize the input - // and keeps a brushed motor from over heating ;) + delay(3); // Pausa, aiuta a stabilizzare l'input + } +/* Domande - +1. Cosa succede quando il motore riceve poca corrente? +2. Impostare un valore minimo per la partenza del motore, + sotto al quale il motore non parte. +*/