50 euro voor de eerste werkende sketch

Als U een gezamenlijk project wil starten of aan projecten van anderen mee wilt werken.
Berichten: 1
Geregistreerd: 17 Sep 2015, 01:20

50 euro voor de eerste werkende sketch

Berichtdoor zwazi » 17 Sep 2015, 02:12

Ik heb een robothoofd gemaakt met een 3d printer, en er 5 servo's ingebouwd. ik heb een UNO en een I/O breakout board.
ik bedien de servos met pots, en wil de output graag terugkoppelen (teach functie). liefst rond vrijdag/zaterdag.
Ik heb 50 euro voor de eerste die een werkende sketch kan maken die mijn servo's goed laat lopen, met minimale jitter.

Dit is wat ik zelf heb geprobeerd, maar de servo's slaan maar een klein stukje uit, doen het niet allemaal, trillen constant.

#include <Servo.h>


#include <Servo.h>

Servo y_eyes; // create servo object to control a servo
Servo x_eyes;
Servo frown; // create servo object to control a servo
Servo blinkk;
Servo chew;

int potpin1 = 0; // analog pin used to connect the potentiometer
int potpin2 = 1;
int potpin3 = 2; // analog pin used to connect the potentiometer
int potpin4 = 3;
int potpin5 = 4;
int val; // variable to read the value from the analog pin

void setup()
{
y_eyes.attach(3); // attaches the servo on pin 3 to the servo object
x_eyes.attach(5); // attaches the servo on pin 5 to the servo object
frown.attach(6); // attaches the servo on pin 6 to the servo object
blinkk.attach(9); // attaches the servo on pin 9 to the servo object
chew.attach(10); // attaches the servo on pin 10 to the servo object
}

void loop()
{
val = analogRead(potpin1); // reads the value of the potentiometer (value between 0 and 1023)
val = map(val, 1, 1023, 170, 10); // scale it to use it with the servo (value between 0 and 180)
y_eyes.write(val); // sets the servo position according to the scaled value
val = analogRead(potpin2); // reads the value of the potentiometer (value between 0 and 1023)
val = map(val, 1, 1023, 170, 10); // scale it to use it with the servo (value between 0 and 180)
x_eyes.write(val);
val = analogRead(potpin3); // reads the value of the potentiometer (value between 0 and 1023)
val = map(val, 1, 1023, 10, 170); // scale it to use it with the servo (value between 0 and 180)
frown.write(val);
val = analogRead(potpin4); // reads the value of the potentiometer (value between 0 and 1023)
val = map(val, 1, 1023, 10, 170); // scale it to use it with the servo (value between 0 and 180)
blinkk.write(val); // sets the servo position according to the scaled value
val = analogRead(potpin5); // reads the value of the potentiometer (value between 0 and 1023)
val = map(val, 1, 1023, 10, 170); // scale it to use it with the servo (value between 0 and 180)
chew.write(val); // sets the servo position according to the scaled value
// sets the servo position according to the scaled value
delay(15); // waits for the servo to get there
}

Advertisement

Berichten: 4064
Geregistreerd: 16 Okt 2013, 14:31
Woonplaats: s hertogenbosch

Re: 50 euro voor de eerste werkende sketch

Berichtdoor shooter » 17 Sep 2015, 23:04

de potpinnen moeten A0 en zo verder heten.
hoe heb je de potmeters aangesloten?
hoe zit de voeding in elkaar?
bank is 3465370
je mag sms naar 0653300739
paul deelen
shooter@home.nl

Berichten: 4064
Geregistreerd: 16 Okt 2013, 14:31
Woonplaats: s hertogenbosch

Re: 50 euro voor de eerste werkende sketch

Berichtdoor shooter » 22 Sep 2015, 13:09

nog steeds niets ontvangen
paul deelen
shooter@home.nl

Terug naar Gezamenlijke projecten

Wie is er online?

Gebruikers in dit forum: Geen geregistreerde gebruikers en 5 gasten