sabato 2 marzo 2019

MG995

MG995 (Video)




Prova del servo motore MG995; Esempio arduino "Knob"

Codice utilizzato:

/*
 Controlling a servo position using a potentiometer (variable resistor)
 by Michal Rinott

 modified on 8 Nov 2013
 by Scott Fitzgerald
 http://www.arduino.cc/en/Tutorial/Knob
*/

#include (Servo library)

Servo myservo;  // create servo object to control a servo

int potpin = 0;  // analog pin used to connect the potentiometer
int val;    // variable to read the value from the analog pin

void setup() {
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object
}

void loop() {
  val = analogRead(potpin);            // reads the value of the potentiometer (value between 0 and 1023)
  val = map(val, 0, 1023, 0, 180);     // scale it to use it with the servo (value between 0 and 180)
  myservo.write(val);                  // sets the servo position according to the scaled value
  delay(15);                           // waits for the servo to get there
}
 


Schema circuito:





Variante con Joystick, usando lo stesso code:






giovedì 21 febbraio 2019

Distributore Capsule a moneta

Progetto per la realizzazione di un dispenser per capsule.








Questo è il codice che ho usato:

#include (stepper library)
int pinLed = 13;
#define motor1 5
#define motor2 6
#define motor3 7
#define motor4 8
#define STEPS  32  
int  Steps2Take; 
Stepper small_stepper(STEPS, 5, 7, 6, 8);

const int IRPin = 3;

void setup() {
pinMode(pinLed,OUTPUT);
pinMode(motor1, OUTPUT);
pinMode(motor2, OUTPUT);
pinMode(motor3, OUTPUT);
pinMode(motor4, OUTPUT);
}

void loop() {
digitalWrite(pinLed,HIGH);
int IRState = digitalRead(IRPin);

if (IRState == LOW)
{
small_stepper.setSpeed(500);
Steps2Take  =  256; 
small_stepper.step(Steps2Take);
delay(2000);
  }
}

giovedì 18 settembre 2014

sabato 26 luglio 2014

venerdì 13 giugno 2014

mercoledì 28 maggio 2014

Tulli


mercoledì 7 maggio 2014

sabato 3 maggio 2014

domenica 27 aprile 2014

martedì 14 gennaio 2014

Citazione

...no serve skrivare "cit"...se capisse sempre se na frase no se de ki ke la dise o scrive.

martedì 24 dicembre 2013

sabato 21 dicembre 2013

venerdì 20 dicembre 2013

Parole

Le parole sono solo parole. i se i fati ke konta, un pol essare anka trendy...basta ke fassa ben kueo ke ga da fare sensa tirarghea in kel posto al prosimo suo, ke se anka el mio e anka el tuo.

El secreto de la tarde


sabato 26 ottobre 2013

domenica 11 agosto 2013

Il suono delle cose

...si se vero ke le robe ciapa importansa anka pal suone ke le ga'.