Published © GPL3+

Webpage Message Sender

Type a short message on a webpage and have it be sent and displayed on a Particle OLED shield/screen!

BeginnerFull instructions provided30 minutes1,739
Webpage Message Sender

Things used in this project

Hardware components

Electron
Particle Electron
×1
SparkFun Photon Micro OLED Shield
×1
Breadboard (generic)
Breadboard (generic)
×1

Story

Read more

Schematics

The assembly

Just put the Electron on the OLED shield

Code

Webpage

HTML
Double click, sub in your Access Token and Device ID and you should be ready to go!
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript" charset="utf-8"></script>

<script>
var accessToken = "ACCESS TOKEN";
var deviceID = "DEVICE ID"
var url = "https://api.particle.io/v1/devices/" + deviceID + "/sender";

function callback(data, status){
	if (data.return_value == 1) {
		alert(" Message being sent");
	}
	else
	{
		alert("Could not Connect to your Device");
	}
}

function sendMessage(){
	message = $("#message").val();
   	$.post(url, {params: message, access_token: accessToken}, callback);
}

</script>


</head>

<body>

<h1>Message Sender</h1>
<input id="message" value="Hello!" size="64"/>
<input type="button" value="Send" onclick="sendMessage()" /> <br/>

</body>
</html>

Credits

Thanks to Simon Monk.

Comments