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
# python 3.5 version | |
from http.server import BaseHTTPRequestHandler, HTTPServer | |
from serial import Serial | |
ser = Serial('COM9') | |
class MyHandler(BaseHTTPRequestHandler): | |
def do_POST(self): | |
self.send_response(200) |
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
# python 2.7 version | |
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler | |
class MyHandler(BaseHTTPRequestHandler): | |
def do_GET(self): | |
self.send_response(200) | |
self.send_header("Content-type", "text/html") | |
self.end_headers() |
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
int light = 9; | |
void setup() { | |
Serial.begin(9600); | |
pinMode(light, OUTPUT); | |
} | |
void loop() { | |
if(Serial.available()) { | |
char indata = Serial.read(); |
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
# python 2.7 version | |
import BaseHTTPServer | |
from serial import Serial | |
ser = Serial('COM6') | |
class MyHandler(BaseHTTPServer.BaseHTTPRequestHandler): | |
def do_POST(self): | |
self.send_response(200) |
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
int led = 13; | |
void setup() { | |
Serial.begin(9600); | |
pinMode(led, OUTPUT); | |
} | |
void loop() { | |
if(Serial.available()) { | |
char indata = Serial.read(); |
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
# python 2.7 version | |
from serial import Serial | |
ser = Serial('COM6', 9600) | |
while 1: | |
print ser.readline() |
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
void setup() { | |
Serial.begin(9600); | |
} | |
void loop() { | |
Serial.println("Hello World"); | |
delay(1000); | |
} |
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 <SoftwareSerial.h> | |
SoftwareSerial BTSerial(2, 3); | |
const int ledPin = 9; | |
char indata; | |
void setup() { | |
BTSerial.begin(9600); | |
pinMode(ledPin, OUTPUT); |
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
int light = 9; | |
void setup() { | |
Serial.begin(9600); | |
pinMode(light, OUTPUT); | |
} | |
void loop() { | |
if(Serial.available()) { | |
char ind = Serial.read(); |
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 <SoftwareSerial.h> | |
int rx=2; int tx=3; | |
SoftwareSerial BTSerial(rx, tx); | |
const int ledPin = 13; | |
void setup() { | |
BTSerial.begin(9600); | |
pinMode(ledPin, OUTPUT); |
NewerOlder