Hardware components | ||||||
| × | 1 | ||||
| × | 1 | ||||
Software apps and online services | ||||||
|
The basic idea for this project came from the characteristics of mkr1000. It is small, light and wifi controlled.
This is an application for everyone. Everyone can do it ("Do it yourself"). It can be sold in every family in every corner of the globe.
All you need is to purchase mkr1000 and some balloons with helium .
Follow these steps :
• Inflate the balloons with a light gas (e.g. helium)
• Write in balloons "Happy birthday"
• Place the led and connect them to mkr1000
• Upload the attached code.
• Ready
Just do it.
#include <SPI.h>
#include <WiFi101.h>
char ssid[] = "CONNX";
char pass[] = "*****";
int keyIndex = 0;
int status = WL_IDLE_STATUS;
WiFiServer server(80);
void setup() {
Serial.begin(9600);
pinMode(0, OUTPUT);
pinMode(1, OUTPUT);
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
if (WiFi.status() == WL_NO_SHIELD) {
Serial.println("WiFi shield not present");
while (true);
}
while ( status != WL_CONNECTED) {
Serial.print("Attempting to connect to Network named: ");
Serial.println(ssid);
status = WiFi.begin(ssid, pass);
delay(10000);
}
server.begin();
printWifiStatus();
}
void loop() {
WiFiClient client = server.available();
if (client) {
Serial.println("new client");
String currentLine = "";
while (client.connected()) {
if (client.available()) {
char c = client.read();
Serial.write(c);
if (c == '\n') {
if (currentLine.length() == 0) {
client.println("HTTP/1.1 200 OK");
client.println("Content-type:text/html");
client.println();
client.print("Click <a href=\"/H\">here</a> turn the LED on pin 0123456 on<br>");
client.print("Click <a href=\"/L\">here</a> turn the LED on pin 0123456 off<br>");
client.println();
break;
}
else {
currentLine = "";
}
}
else if (c != '\r') {
currentLine += c;
}
if (currentLine.endsWith("GET /H")) {
digitalWrite(0, HIGH);
delay (100);
digitalWrite(1, HIGH);
delay (100);
digitalWrite(2, HIGH);
delay (100);
digitalWrite(3, HIGH);
delay (100);
digitalWrite(4, HIGH);
delay (100);
digitalWrite(5, HIGH);
delay (100);
digitalWrite(6, HIGH);
delay (100);
digitalWrite(7, HIGH);
delay (1000);
digitalWrite(0, LOW);
digitalWrite(1, LOW);
digitalWrite(2, LOW);
digitalWrite(3, LOW);
digitalWrite(4, LOW);
digitalWrite(5, LOW);
digitalWrite(6, LOW);
digitalWrite(7, LOW);
delay (1000);
}
if (currentLine.endsWith("GET /L")) {
digitalWrite(0, LOW);
digitalWrite(1, LOW);
digitalWrite(2, LOW);
digitalWrite(3, LOW);
digitalWrite(4, LOW);
digitalWrite(5, LOW);
digitalWrite(6, LOW);
digitalWrite(7, LOW);
}
}
}
client.stop();
Serial.println("client disonnected");
}
}
void printWifiStatus() {
Serial.print("SSID: ");
Serial.println(WiFi.SSID());
IPAddress ip = WiFi.localIP();
Serial.print("IP Address: ");
Serial.println(ip);
long rssi = WiFi.RSSI();
Serial.print("signal strength (RSSI):");
Serial.print(rssi);
Serial.println(" dBm");
Serial.print("To see this page in action, open a browser to http://");
Serial.println(ip);
Comments