hello! I'm on project 5 (mood cue) on my Arduino starter kit. I used the 05 Starter Kit: Mood Cue - YouTube yet after finishing the tutorial the potentiometer isn't moving the servo motor. as soon as I uploaded the code the servo motor just moved to one side and stuck there. does anyone know what's happend?
Please post clear photos showing your wiring.
Please post the code and schematic here. I do not have time to watch a video in order to try to help you.
Please don't make us watch a video - just post your code.
Arduino.cc says, "... You can find the Arduino code for all these projects within the Arduino IDE, click on File / Examples / 10.StarterKit..."
(I have not verified this... on cellular)
Yes, it's there:
/*
Arduino Starter Kit example
Project 5 - Servo Mood Indicator
This sketch is written to accompany Project 5 in the Arduino Starter Kit
Parts required:
- servo motor
- 10 kilohm potentiometer
- two 100 uF electrolytic capacitors
created 13 Sep 2012
by Scott Fitzgerald
https://store.arduino.cc/genuino-starter-kit
This example code is part of the public domain.
*/
// include the Servo library
#include <Servo.h>
Servo myServo; // create a servo object
int const potPin = A0; // analog pin used to connect the potentiometer
int potVal; // variable to read the value from the analog pin
int angle; // variable to hold the angle for the servo motor
void setup() {
myServo.attach(9); // attaches the servo on pin 9 to the servo object
Serial.begin(9600); // open a serial connection to your computer
}
void loop() {
potVal = analogRead(potPin); // read the value of the potentiometer
// print out the value to the Serial Monitor
Serial.print("potVal: ");
Serial.print(potVal);
// scale the numbers from the pot
angle = map(potVal, 0, 1023, 0, 179);
// print out the angle for the servo motor
Serial.print(", angle: ");
Serial.println(angle);
// set the servo position
myServo.write(angle);
// wait for the servo to get there
delay(15);
}
I will take a SWAG and say it is not wired correctly. I think it is the purple wire going to the orange pot.
oh found the issue.
I connected the power cable for the potentiometer to the microcontroller and not the breadboard.
so yes I did wire it incorrectly. thank you for making me double check.
thank you for your time
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.