]> git.piffa.net Git - sketchbook_andrea/commitdiff
Merge branch 'master' of kim:/home/git/sketchbook_andrea
authorAndrea Manni <andrea@piffa.net>
Wed, 5 Apr 2017 14:07:07 +0000 (16:07 +0200)
committerAndrea Manni <andrea@piffa.net>
Wed, 5 Apr 2017 14:07:07 +0000 (16:07 +0200)
1  2 
motors/servo/Knob_2/Knob_2.ino
motors/servo/Sweep_1/Sweep_1.ino

index 33e3ad11d36a6cf9994c30dbd5a6bde94c477117,08bd2098d0dfdc99f8fec90c5386d184b8251532..50fa832637e42ad0a1e9aab794ec3d8a09ec66fa
@@@ -1,25 -1,13 +1,27 @@@
 -// Controlling a servo position using a potentiometer (variable resistor) 
 -// by Michal Rinott <http://people.interaction-ivrea.it/m.rinott> 
 +/* Knob
 +
 +   Rotazione di un servomotore tramite un potenziometro
 +
 +L'utilizzo della libreria Servo rende inutilizzabile analogWrite()
 +sui pin 9 e 10 dato che utilizza i timer associati a questi PIN.
 +
 +Power: un servo da 9g puo' arrivare ad impegnare 750mA sotto carico
 +(se viene opposta resistenza al movimento del servo), un  SG90 prende 
 +~62mA se il movimento e' libero. Quindi in fase di test il servo puo'
 +essere alimentato direttamente da una scheda Arduino (200ma dal PIN 5v)
 +ma per l'uso finale dovra' essere alimentato autonomamente.
 +
 +Schema: 
 +- https://www.arduino.cc/en/uploads/Tutorial/knob_bb.png
 +*/
  
+ // Schema: https://lab.piffa.net/schemi/potenziometro_bb.png
  #include <Servo.h> 
   
  Servo myservo;  // create servo object to control a servo 
   
int potpin = 0;  // analog pin used to connect the potentiometer
const int potpin = A0;  // analog pin used to connect the potentiometer
  int val;    // variable to read the value from the analog pin 
  
  void setup() 
index c64ea5d973f9b145dc77b586316f4f9f2c499243,4c0c39fba56683c52f931947c4409d41adada834..dd9136451d0ff3d94ec23cfc443302e66ce23a15
@@@ -1,19 -1,7 +1,19 @@@
 -// Sweep
 -// by BARRAGAN <http://barraganstudio.com> 
 -// This example code is in the public domain.
 +/* Sweep
  
 +   Rotazione di un servomotore tramite la librerio Servo.h .
 +
 +L'utilizzo della libreria Servo rende inutilizzabile analogWrite()
 +sui pin 9 e 10 dato che utilizza i timer associati a questi PIN.
 +
 +Power: un servo da 9g puo' arrivare ad impegnare 750mA sotto carico
 +(se viene opposta resistenza al movimento del servo), un  SG90 prende 
 +~62mA se il movimento e' libero. Quindi in fase di test il servo puo'
 +essere alimentato direttamente da una scheda Arduino (200ma dal PIN 5v)
 +ma per l'uso finale dovra' essere alimentato autonomamente.
 +
 +Schema: https://www.arduino.cc/en/uploads/Tutorial/sweep_bb.png
 +        http://microbotlabs.com/images/mearm-uno-servo-1.jpg
 +   */
  
  #include <Servo.h> 
   
@@@ -30,12 -18,12 +30,12 @@@ void setup(
   
  void loop() 
  { 
-   for(pos = 0; pos < 180; pos += 1)  // goes from 0 degrees to 180 degrees 
+   for (pos = 0; pos < 180; pos += 1)  // goes from 0 degrees to 180 degrees 
    {                                  // in steps of 1 degree 
      myservo.write(pos);              // tell servo to go to position in variable 'pos' 
      delay(15);                       // waits 15ms for the servo to reach the position 
    } 
-   for(pos = 180; pos>=1; pos-=1)     // goes from 180 degrees to 0 degrees 
+   for (pos = 180; pos >= 1; pos -= 1)     // goes from 180 degrees to 0 degrees 
    {                                
      myservo.write(pos);              // tell servo to go to position in variable 'pos' 
      delay(15);                       // waits 15ms for the servo to reach the position