Things used in this project

Code

blynkweather.inoC/C++
Code for Energia
///
/// @mainpage	blynkWeather
///
/// @details	Blynk with Weather for CC3200
/// @n
/// @n
/// @n @a		Developed with [embedXcode+](http://embedXcode.weebly.com)
///
/// @author		Rei Vilo
/// @author		http://embeddedcomputing.weebly.com
/// @date		23/07/2015 13:58
/// @version	101
///
/// @copyright	(c) Rei Vilo, 2015
/// @copyright	CC = BY SA NC
///
/// @see		ReadMe.txt for references
///


///
/// @file		blynkWeather.ino
/// @brief		Main sketch
///
/// @details	Example sketch
/// @n @a		Developed with [embedXcode+](http://embedXcode.weebly.com)
///
/// @author		Rei Vilo
/// @author		http://embeddedcomputing.weebly.com
/// @date		23/07/2015 13:58
/// @version	101
///
/// @copyright	(c) Rei Vilo, 2015
/// @copyright	CC = BY SA NC
///
/// @see		ReadMe.txt for references
/// @n
///


// Core library for code-sense - IDE-based
#if defined(ENERGIA) // LaunchPad specific
#include "Energia.h"
#else // error
#error Platform not defined
#endif // end IDE

// Include application, user and local libraries
#include "Wire.h"
#include "Sensor_BMP180.h"
#include "Sensor_DHT.h"
#include "Sensor_PIR.h"

#ifndef __CC3200R1M1RGC__ // Do not include SPI for CC3200 LaunchPad
#include <SPI.h>
#endif
#include "WiFi.h"
#include <WiFiClient.h>
#include <BlynkSimpleCC3200.h>
#include "SimpleTimer.h"


// Prototypes


// Define variables and constants
Sensor_BMP180 myBMP180;
Sensor_DHT myDHT(24, DHT22);
Sensor_PIR myPIR(27);


#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space


// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "AuthToken";
SimpleTimer Timer;
const uint8_t myRelay = 23;

bool alarm = false;

void sendUptime()
{
    myPIR.get();
    alarm |= myPIR.status();
    BLYNK_LOG("myPIR    %8i %8i", myPIR.status(), alarm);
    digitalWrite(RED_LED, alarm);

    // You can send any value at any time.
    // Please don't send more that 10 values per second.
    Blynk.virtualWrite(4, alarm);
}

// Add setup code
void setup()
{
    Serial.begin(9600);

    Wire.begin(); // required by BMP180
    myBMP180.begin(3);
    myDHT.begin();
    myPIR.begin();
    
    pinMode(RED_LED, OUTPUT);
    digitalWrite(RED_LED, HIGH);
    delay(1000);
    digitalWrite(RED_LED, LOW);

    Blynk.begin(auth, "SSID", "password", 0); // WLAN_SEC_WPA2

    // Setup a function to be called every second
    Timer.setInterval(1000L, sendUptime);
}

// Add loop code
void loop()
{
    Blynk.run();
    Timer.run();
}

// This function tells Arduino what to do if there is a Widget
// which is requesting data for Virtual Pin (0)
BLYNK_READ(0)
{
    myBMP180.get();
    float t1 = myBMP180.temperature();
    float p  = myBMP180.pressure();
    // This command writes t1 to Virtual Pin (0)
    Blynk.virtualWrite(0, t1);
    // This command writes p to Virtual Pin (0)
    Blynk.virtualWrite(1, p);
    BLYNK_LOG("myBMP180 %8.1f %8.1f", t1, p);
}

// This function tells Arduino what to do if there is a Widget
// which is requesting data for Virtual Pin (2)
BLYNK_READ(2)
{
    myDHT.get();
    float t2 = myDHT.temperature();
    float rh = myDHT.humidity();
    // This command writes t2 to Virtual Pin (2)
    Blynk.virtualWrite(2, t2);
    // This command writes rh to Virtual Pin (3)
    Blynk.virtualWrite(3, rh);
    BLYNK_LOG("myDHT    %8.1f %8.1f", t2, rh);
}

// This function will be called every time
// when App writes value to Virtual Pin 5
BLYNK_WRITE(5)
{
    BLYNK_LOG("Reset alarm %s", param.asStr());
    // You can also use: asInt() and asDouble()
    if (param.asInt() > 0) alarm = false; // reset
}

Credits

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

Upload code to TI TM4C123 using Linux, CMake and lm4tools
Intermediate
  • 14
  • 1

Protip

This is a step by step guide on how to get CMake and lm4tools setup in a Linux environment to upload code directly to your TM4C123 via usb.

Handheld Game Console: Zombieland
Intermediate
  • 642
  • 10

Full instructions

Fun and cool TI LaunchPad game console that allows you to play the game called Zombieland!

LoRaCatKitty Build IoT Applications with LoRaWAN in 3 Steps
Intermediate
  • 1,044
  • 7

Protip

LoRaCatKitty Build IoT Applications with LoRaWAN in 3 steps with The Thing Networks and Cayenne.

Build Your Own Amazon Echo Using a RPI and ReSpeaker HAT
Intermediate
  • 6,457
  • 33

Full instructions

How to build your own Amazon Echo using a Raspberry Pi and ReSpeaker 2-Mics HAT.

Android App-Based Home Automation System Using IOT
Intermediate
  • 2,634
  • 18

Full instructions

Control and monitor the home environment using Android app with advanced features such as voice command, scheduling, home preparing itself.

Die Losungen - every day a new bible verse
Intermediate
  • 34
  • 0

Full instructions

You love daily changing bible verse? Then the "Die Losungen" are a concept: here they are represented with value added information

ProjectsCommunitiesTopicsContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login