Things used in this project

Code

blynk_servo.inoC/C++
#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <SPI.h>
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEnergiaWiFi.h>
#include <SimpleTimer.h>
#include <Servo.h>
Servo myservo;
int potpin = 2;  // analog pin used to connect the potentiometer
int val;    // variable to read the value from the analog pin 
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "XXXXXXXXXXXXXXXXXXXX"; //Use your auth token from the app
SimpleTimer timer;
// Your WiFi credentials
char ssid[] = "WiFi SSID HERE";
char pass[] = "WiFi PASSWORD HERE";        // Set to "" for open networks

void setup()
{
  //Open a serial terminal with the PC
  Serial.begin(9600);   
  Serial.println("Begining...");
  //Set up a blynk connection with your WiFi credentials
  Blynk.begin(auth, ssid, pass);  
  Serial.println("Connected to Blynk...");
  while (Blynk.connect() == false) {
    // Wait until connected
  }
  myservo.attach(19);  
}

// Virtual Pin 1 - Toggles the LED high or low depending on the mobile app input
BLYNK_WRITE(V0)
{  
  int i = param.asInt();         //Read the X-Axis value and save it to the variable i
  BLYNK_LOG("Got a value: %s!", param.asStr()); 
  val = map(i, 0, 255, 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 
}

// The main loop listens for commands from the mobile app
void loop()
{
  Blynk.run();
  timer.run();
}

Credits

As4lz5rp
Daniel Oglvie

Launchpad Engineer at Texas Instruments

Contact

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

Wi-Fi IoT Workshop for TI LaunchPad+Educational BoosterPack
Easy
  • 1,350
  • 121

Full instructions

Get started with some IoT projects. Learn how to use Wi-Fi wireless communication with the TI LaunchPad.

ASEE 2017: TI LaunchPad 4 Student Owned Freshman Experience
Easy
  • 133
  • 1

Protip

Learn how to use low cost student owned hardware for hands on intro courses.

Control Your Bot From Anywhere
Easy
  • 18
  • 0

Full instructions

IoT with your robot at one place and your phone another, both connected via internet.

MSP432 Fun with IoT Workshop 2016
Easy
  • 3,288
  • 68

Full instructions

Explore the Educational BoosterPack paired with the MSP432 LaunchPad and then take that to the cloud with the CC3100 Wi-Fi BoosterPack!

MIT IAP 2016 Lab
Easy
  • 1,962
  • 46

A collection of the 6 labs for the MIT IAP Texas Instruments LaunchPad Workshop

Texas Instruments MSP-EXP432 - MultiTasking
Easy
  • 583
  • 18

Protip

MultiTasking ultrasonic and color sensor with Texas Instruments MSP-EXP432 and Energia.

Add projectSign up / Login