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

E-Ink Display based Static Desktop eCalendar
Easy
  • 8
  • 2

Full instructions

An electronic Desktop Calendar based on Electronic Ink Display controlled by TM4C123 Tiva(ARM) development board & programmed in Energia IDE

MSP432 Fun with IoT Workshop 2016
Easy
  • 3,536
  • 69

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
  • 2,021
  • 47

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

Texas Instruments MSP-EXP432 - MultiTasking
Easy
  • 708
  • 20

Protip

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

Control a CC3200 LaunchPad with your phone using Blynk
Easy
  • 6,345
  • 28

Full instructions

Read sensor data and toggle LEDs with the Blynk mobile app and the TI CC3200 LaunchPad

Mongoose Embedded Networking Library on mbed+CC3100
Easy
  • 651
  • 12

Protip

Mongoose, the most popular open source embedded web server and networking library now supports the mbed platform. See CC3100 example.

Add projectSign up / Login