Skip to content

Instantly share code, notes, and snippets.

var HOST = '127.0.0.1';
var PORT = 3011;
function log(objs) {
var d = new Date,
fmtDate = '',
month;
var msg = {};
month = d.getMonth() + 1;
#include "Arduino.h"
#include <WebSocketClient.h>
#include <SPI.h>
#include <Ethernet.h>
// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; /* Edit here */
@rockos
rockos / plcConnect.js
Created May 2, 2013 07:10
Client program which communicate to plc(programmable logical controller for Mitsubishi elec.)
#!/usr/bin/env node
'use strict';
/*
*
*
*/
//var redis = require("redis"),
// rd = redis.createClient();
var net = require('net');
var conf = './plc.conf';
@rockos
rockos / plcsrv.js
Last active December 16, 2015 21:29
Server program which simulates PLC(programmable logical controller for Mitsubishi elec.)
#!/usr/bin/env node
var redis = require("redis"),
client = redis.createClient();
var net = require('net');
var HOST = '127.0.0.1';
var PORT = 3011;
function log(objs) {
var d = new Date,
fmtDate = '',
/**
* simple RESTful server on SNOWSHOE
*
* @author : rockos
*/
#include "srvhttp.h"
static DBM dbm;
#include <Servo.h>
Servo myservo;
void setup()
{
myservo.attach(8);
}
void loop()
{
myservo.write(0);
delay(500);
#define MAX_DIGIT 3
int readData() {
char c[MAX_DIGIT] = "0";
for (int i = 0; i < MAX_DIGIT; i++ ) {
c[i] = Serial.read();
if (c[i] =='¥0')
break;
}
return atoi(c);
}
#include <Servo.h>
Servo srv;
int deg = 0;
int save_deg = 0;
void setup()
{
srv.attach(8);
Serial.begin(9600);
}
#include <Servo.h>
Servo u_srv;
Servo l_srv;
void setup()
{
u_srv.attach(10);
l_srv.attach(12);
}
#include <Servo.h>
#define MAX_DIGIT 3
Servo u_srv;
Servo l_srv;
int deg = 0;
int save_deg = 0;
void setup()