Skip to content

Instantly share code, notes, and snippets.

View biskandar's full-sized avatar
💭
Spring Boot + Kubernetes = DevOps

Benny biskandar

💭
Spring Boot + Kubernetes = DevOps
View GitHub Profile
@biskandar
biskandar / 2012101604.c
Created October 16, 2012 09:00
Reading Arduino's Analog Pins with JSON Protocol by using WiFi Shield 2012101604
aJsonObject *jsonAnalogs() {
aJsonObject *jsonRoot = aJson.createObject() ;
aJson.addNumberToObject( jsonRoot , "millis" , (int) millis() ) ;
aJsonObject *jsonAnalogs = aJson.createIntArray( arrAnalogs , maxAnalogs ) ;
aJson.addItemToObject( jsonRoot , "analogs" , jsonAnalogs ) ;
return jsonRoot ;
}
@biskandar
biskandar / 2012101605.c
Created October 16, 2012 09:02
Reading Arduino's Analog Pins with JSON Protocol by using WiFi Shield 2012101605
#include <aJSON.h>
void loop() {
if ( ( ctrSeconds % secDebug ) == 0 ) {
// infoAnalogs() ;
Serial.println( aJson.print( jsonAnalogs() ) ) ;
}
}
@biskandar
biskandar / 2012101606.c
Created October 16, 2012 09:03
Reading Arduino's Analog Pins with JSON Protocol by using WiFi Shield 2012101606
void processHttpClient() {
// verify if there is new client connected
WiFiClient client = server.available() ;
if ( !client ) return ;
Serial.println( "Client connected" ) ;
// prepare for reading request data
boolean isBlankLine = true ;
@biskandar
biskandar / 2012101607.c
Created October 16, 2012 09:03
Reading Arduino's Analog Pins with JSON Protocol by using WiFi Shield 2012101607
#include <aJSON.h>
#include <SPI.h>
#include <WiFi.h>
// build web server with listener port 80
WiFiServer server( 80 ) ;
void setup() {
// validate if the wifi shield plugged
if ( WiFi.status() == WL_NO_SHIELD ) {
@biskandar
biskandar / 2012101611.c
Created October 16, 2012 09:06
Build Webserver with Arduino Leonardo and WiFi Shield 2012101611
#include <SPI.h>
#include <WiFi.h>
char ssid[] = "biskandar" ;
char pass[] = "*******" ;
int status = WL_IDLE_STATUS ;
// build web server with listener port 80
WiFiServer server( 80 ) ;
@biskandar
biskandar / 2012101612.c
Created October 16, 2012 09:07
Build Webserver with Arduino Leonardo and WiFi Shield 2012101612
void setup() {
// initialize serial
Serial.begin( 9600 ) ;
while( !Serial ) ; // it only start the code when found serial pc terminal connected
// validate if the wifi shield plugged
if ( WiFi.status() == WL_NO_SHIELD ) {
Serial.println( "Wifi shield is not plugged yet" ) ;
while( true ) ;
@biskandar
biskandar / 2012101613.c
Created October 16, 2012 09:08
Build Webserver with Arduino Leonardo and WiFi Shield 2012101613
void loop() {
// verify if there is new client connected
WiFiClient client = server.available() ;
if ( !client ) return ;
// prepare for reading request data
boolean isBlankLine = true ;
// found new client connected and process the request data
@biskandar
biskandar / 2012101701.c
Created October 17, 2012 06:47
Request Counter with Arduino Uno + Ethernet Shield + LCD Shield 2012101701
#include <SPI.h>
#include <Ethernet.h>
#include <LiquidCrystal.h>
// prepare for lcd shield
LiquidCrystal lcd( 8 , 9 , 4 , 5 , 6 , 7 ) ;
// prepare for ethernet shield
byte mac[] = { 0x00 , 0x08 , 0xDC , 0x00 , 0x00 , 0x09 } ;
@biskandar
biskandar / 2012101702.c
Created October 17, 2012 06:56
Request Counter with Arduino Uno + Ethernet Shield + LCD Shield 2012101702
void loop() {
// verify if there is new client connected
EthernetClient client = server.available() ;
if ( !client ) return ;
// prepare for reading request data
boolean isBlankLine = true ;
// read and proces the client request data
@biskandar
biskandar / 2013032301.c
Created March 23, 2013 01:43
Integration between Raspberry Pi and Arduino
#include "arduPi.h"
int main () {
setup() ;
while(1) {
loop() ;
}
return 0;
}