Introduction: Blynk Arduino Servo
For this lab we will be creating a Servo motor that can be controlled with a smart phone. The app needed for this is called bkynk and you will need to download it to your smart phone and the library for your aduino.
http://docs.blynk.cc/#hardware-set-ups-arduino-ove...
That is the website where you can get the library.
Also once the servo goes past a certain position, an LED light will turn on.
Step 1: Materials
For this you will need:
-Arduino Uno
-Servo motor
-LED light
-220ohm resistor
-breadboard
-smartphone
Step 2: Connect Power
First, you will need to connect the power to the board. Also, ground the board too.
Step 3: Connect the Servo Motor
Secondly, connect the power and ground on the motor to the power and ground on the breadboard.
Then, connect the yellow wire to pin 11, pulse width modulation.
Step 4: Connect the Light
Third, connect the power and ground of LED to breadboard. and connect the resistor to the anode to the pin 7.
Step 5: Code
#define BLYNK_PRINT SwSerial
#include <softwareSerial.h>
SoftwareSerial SwSerial(10, 11); // RX, TX
#include <BlynkSimpleStream.h>
#include <servo.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "645f1bbd27c4410c81a5f9d89aa75260";
Servo servo;
BLYNK_WRITE(V3)
{
servo.write(param.asInt());
}
void setup() {
// Debug console
SwSerial.begin(9600);
// Blynk will work through Serial
// Do not read or write this serial manually in your sketch
Serial.begin(9600);
Blynk.begin(Serial, auth);
servo.attach(9);
}
void loop() {
Blynk.run();
if(param.asInt() > 90)
{
digitalWrite(13, HIGH);
}
else
{
digitalWrite(13, LOW);
}
}
}
Step 6: Blynk
for use with the blynk app, consult this page.
http://docs.blynk.cc/#hardware-set-ups-arduino-over-usb-no-shield
Comments
Question 3 years ago on Step 5
Hey crockettcal, Thanks for posting this. I'm super new to this so please bear with me. I'm trying to build your project. Here is where I am so far. On the blink side I was successful blinking an LED with a button push. From there I built the circuit as you described. Added my auth# to your code and ran the verify in the IDE. This is where I get this error
Arduino: 1.8.10 (Mac OS X), Board: "Arduino/Genuino Uno"
/Users/nickstrickland/Documents/Arduino/Blink_Servo_control_1/Blink_Servo_control_1.ino: In function 'void loop()':
Blink_Servo_control_1:50:4: error: 'param' was not declared in this scope
if(param.asInt() > 90)
^~~~~
/Users/nick/Documents/Arduino/Blink_Servo_control_1/Blink_Servo_control_1.ino:50:4: note: suggested alternative: 'GpsParam'
if(param.asInt() > 90)
^~~~~
GpsParam
/Users/nick/Documents/Arduino/Blink_Servo_control_1/Blink_Servo_control_1.ino: At global scope:
Blink_Servo_control_1:67:1: error: expected declaration before '}' token
}
^
Multiple libraries were found for "SoftwareSerial.h"
Used: /Applications/Arduino.app/Contents/Java/hardware/arduino/avr/libraries/SoftwareSerial
Multiple libraries were found for "BlynkSimpleStream.h"
Used: /Users/nick/Documents/Arduino/libraries/Blynk
Multiple libraries were found for "Servo.h"
Used: /Applications/Arduino.app/Contents/Java/libraries/Servo
exit status 1
'param' was not declared in this scope
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
The bolded part is the highlighted error. I've tried to research a solution but I'm afraid I don't know enough yet to properly search for the right thing. Any help would be greatly appreciated.
Thanks.
-N