This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <NewPing.h> | |
//Tell the Arduino where the sensor is hooked up | |
NewPing sonar(12, 13); | |
int enableA = 11; | |
int pinA1 = 6; | |
int pinA2 = 5; | |
int enableB = 10; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Motor A pins (enableA = enable motor, pinA1 = forward, pinA2 = backward) | |
int enableA = 11; | |
int pinA1 = 6; | |
int pinA2 = 5; | |
//Motor B pins (enabledB = enable motor, pinB2 = forward, pinB2 = backward) | |
int enableB = 10; | |
int pinB1 = 4; | |
int pinB2 = 3; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* The MySensors Arduino library handles the wireless radio link and protocol | |
* between your home built sensors/actuators and HA controller of choice. | |
* The sensors forms a self healing radio network with optional repeaters. Each | |
* repeater and gateway builds a routing tables in EEPROM which keeps track of the | |
* network topology allowing messages to be routed to nodes. | |
* | |
* Created by Henrik Ekblad <henrik.ekblad@mysensors.org> | |
* Copyright (C) 2013-2015 Sensnology AB | |
* Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"text":"These posts are still doing well: <http://www.makeuseof.com/tag/control-philips-hue-lights-arduino-and-motion-sensor/> (1392) ... <http://www.makeuseof.com/tag/3-easy-ways-tablet-stand/> (1037) ... <http://www.makeuseof.com/tag/upgrade-ps4s-hard-drive/> (2966) ","unfurl_links": true} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Basic MQTT example | |
*/ | |
#include <SPI.h> | |
#include <Ethernet.h> | |
#include <PubSubClient.h> | |
// Our first sensor, a cheap DHT11 temperature and humidty sensor | |
#include <DHT.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import bluetooth | |
import time | |
import requests | |
from requests.exceptions import ConnectionError | |
payload ='' | |
while True: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import bluetooth | |
import time | |
while True: | |
print "Checking " + time.strftime("%a, %d %b %Y %H:%M:%S", time.gmtime()) | |
result = bluetooth.lookup_name('78:7F:70:38:51:1B', timeout=5) | |
if (result != None): | |
print "User present" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import bluetooth | |
import time | |
import RPi.GPIO as GPIO | |
GPIO.setmode(GPIO.BCM) | |
RELAY = 23 | |
GPIO.setup(RELAY, GPIO.OUT) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Talking to Hue from an Arduino | |
By James Bruce (MakeUseOf.com) | |
Adapted from code by Gilson Oguime. https://github.com/oguime/Hue_W5100_HT6P20B/blob/master/Hue_W5100_HT6P20B.ino | |
*/ | |
#include <SPI.h> | |
#include <Ethernet.h> | |
// Hue constants |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set HUB to "192.168.1.216" --change for your bridge IP | |
set USER to "newdeveloper" | |
repeat | |
repeat with bulb from 1 to 2 -- Change if you have more bulbs or want to use a subset | |
set hue to (random number from 5000 to 12750) | |
set sat to (random number from 150 to 255) | |
set bri to (random number from 50 to 255) | |
set transitiontime to (random number from 1 to 3) -- Increase range for slower transitions | |
set query to "{\"sat\":" & sat & ",\"hue\":" & hue & ",\"bri\":" & bri & ",\"transitiontime\":" & transitiontime & "}" | |
set command to "curl --request PUT --data '" & query & "' http://" & HUB & "/api/" & USER & "/lights/" & bulb & "/state/ --connect-timeout 5" |