Putting the I in IoT.

Slides:



Advertisements
Similar presentations
My Internet Safety Guide I have used scratch to program a guide to internet safety using QR codes.
Advertisements

Service Bus Service Bus Access Control.
Anurag Dwivedi & Rudra Pratap Suman.  Open Source electronic prototyping platform based on flexible easy to use hardware and software.
How to use Arduino By: Andrew Hoffmaster.
1 Introduction to Coding. 2 Example Codes A lot of example codes are given with Arduino IDE A code can often be based on a previous example rather than.
Embedded Programming and Robotics
Working with Arduino: Lesson #1: Getting Acquainted with the Kit EGN1007.
DPNM Lab., POSTECH 1/25 CS490K - Internet of Things (IoT) Jonghwan Hyun DPNM Lab. Department of Computer Science and Engineering, POSTECH
Designing For Testability. Incorporate design features that facilitate testing Include features to: –Support test automation at all levels (unit, integration,
A little PHP. Enter the simple HTML code seen below.
Practical Electronics & Programming
GEMVC. The Setup Folders Views Value Objects (VOs) Custom Events Service CFCs Controller Model Application Main MXML.
Introduction to Programming
1 Simple Input/Output  C++ offers the iostream library, which defines a system of character-oriented Input/Output (I/O) using object oriented programming.
The Problem of State. We will look at… Sometimes web development is just plain weird! Internet / World Wide Web Aspects of their operation The role of.
C++ / G4MICE Course Session 2 Basic C++ types. Control and Looping Functions in C Function/method signatures and scope.
Chapter 1: Applying Computer Basics – Lesson 1 © 2010, 2006 South-Western, Cengage Learning.
C++ / G4MICE Course Session 1 - Introduction Edit text files in a UNIX environment. Use the g++ compiler to compile a single C++ file. Understand the C++
Basic Circuits – Lab 4 Serial and OSC (maybe some theory too) Xmedia Spring 2011.
Today: Student will be able to describe the basics of their class and computing Tell me about you and how you use computers. Lesson 1 Slide 1.
Chapter 8 Characters and Strings. Objectives In this chapter, you will learn: –To be able to use the functions of the character handling library ( ctype).
1 Project 4 Address Lookup. Project 4 Write an ASP.NET app that permits users to retrieve addresses from a potentially large list of addresses. There.
Programming in Arduino Materials:Arduino Board Casperelectronics Pre Pres. Notes Photos from workshop?
REEM ALAMER REVISION FOR C LANGUAGE COURSE. OUTPUTS int main (void) { int C1, C2; int *p1, *p2; C1 = 8; p1 = &C1; C2 = *p1 / 2 + 5; p2 = &C2; printf ("C1.
1 Introduction to Coding. 2 Example Codes A lot of example codes are given with Arduino IDE A code can often be based on a previous example rather than.
Programming Paradigms, Software Architectural Patterns, and MVC CS 378 – Mobile Computing for iOS Dr. William C. Bulko.
A little PHP.
More on LED’s with Arduino
User-Written Functions
Section 6.3 Server-side Scripting
User Interaction and Variables
Control Control Devices.
Meta Data Deep Dive Part 2
Designing For Testability
Welcome to Arduino A Microcontroller.
Get Your Project Started with Arduino
More Devices: Control (Making Choices)
Foundations of Programming: Arrays
Command Line Arguments
Chapter 2 Overview of C.
How to install Skype (Step by Step Guide).
Troubleshooting IP Communications
Introduction to Events
Chapter 1: Applying Computer Basics – Lesson 1
Trainings 11/4 Intro to Java.
Administrative things
IoT Programming the Particle Photon.
Working with Arduino: Lesson #1: Getting Acquainted with the Kit
Welcome to Digital Electronics using the Arduino Board
Some Facts about Cricket Tracking System.
Introduction to Java part 2
Send action to ARTIK device
Tonga Institute of Higher Education
Govt. Polytechnic,Dhangar
Reference Parameters.
Arduino Part #3 Variables
Processing Asynchronous REST Requests in Orchestration Designer
Programming 2: The Arduino IDE & First Sketches
Arduino Part 4 Let there be more light.
Hardy 3030 Home Page These slides will walk you through setting up the mapping to send a “Tare” command to the HI 3030 unit. This same principle would.
BIT116: Scripting Functions.
CTY SAR FCPS Shawn Lupoli, Elliot Tan
Lecture 12: The Fetch Api and AJAx
Fundamental Programming
Method exercises Without IF
Let’s Talk about… Smalltalk.
Data Types Every variable has a given data type. The most common data types are: String - Text made up of numbers, letters and characters. Integer - Whole.
Introduction to Arduinos
Registering your returning student at Moody ISD
Exploring the Browse Function
Presentation transcript:

Putting the I in IoT

Up to Now Electronics Software logic Debugging Now… getting on the network

Remember this? Spark.publish(token, data); -token is the String identifier for the event -data is the String message value By the way, there are some overloads. Can add TTL, for example.

Remember this? Spark.subscribe(token, handler, deviceID) token is a String identifier for the event handler is the name of the method you want to run when the event is received deviceID is the ID# of the photon you are listening to The handler should take 2 inputs: void handler(const char *event, const char *data) event is the String identifier data is the interesting part - the String that was sent as value

2 IDs Device ID: Click “Devices” on Build, then open the arrow for the device you are using to see the ID. Access Token: Click “Settings” on Build to see your Access Token

Talk to the Photon “Expose” a function: Spark.function(token, handler); token is a String identifier for the event handler is the name of the method you want to run when the event is received Handler functions take one input, a String, and give one output, an int telling success or failure. Warning: tokens can only be up to 12 letters long. The input string can be up to 63.

Example in setup: Spark.function(“brew”, brewCoffee); then later: int brewCoffee(String command){ if (command.equals(“coffee”)) // turn on pot… return 1;

How to issue the command Something online is going to issue the command to your Photon to perform its function. POST /v1/devices/<DEVICEID>/<HANDLER> where DEVICEID is the Device ID and HANDLER is the name of the function to call. You can add a parameter that is passed to the function as well

curl Useful for debugging - libraries for sending & receiving internet messages through a variety of protocols. Already on Macs, Windows needs a download. Example from coffee machine: curl https://api.particle.io/v1/devices/0123456789abcdef/brew \ -d access_token=123412341234 \ -d "args=coffee"

Hear from the Photon You may expose up to 10 variables: Spark.variable(token, address, type); token is a String identifier of up to 12 characters address is the address of the variable you want to map it to type is the type of the variable which must be either INT, DOUBLE, or STRING Remember how to denote the address of a variable?

Example int temp; // the temperature registered by my temp sensor in setup: Spark.variable(“temperature”, &temp, INT);

How to register the value GET /v1/devices/<DEVICEID>/<TOKEN> curl "https://api.particle.io/v1/devices/0123456789abcdef/temp?access_token=12341 2341234" Open a browser to: https://api.particle.io/v1/devices/<DEVICEID>/<TOKEN>? access_token = <ACCESSTOKEN> You will see the message - “result” is the value of the variable you want.

Let’s try it out Make a circuit: 3.3 -> photoresist -> A0 ->1K ohm -> Ground And D7 -> 220 ohm -> LED -> Ground Use my HTML/Javascript and change the token ids You write the Photon code.