basic sensors and movement
1. find basic movement qualities (LMA) and gestural movement patterns
2. implement these movements with sensors
1. find basic movement qualities (LMA) and gestural movement patterns
2. implement these movements with sensors
今日課程:
回覆刪除軟體:windows下載32位元: http://processing.org
硬體韌體開發工具(IDE):
http://arduino.cc/en/Main/Software
//begin
回覆刪除const int buttonPin = 2; // the number of the pushbutton pin
const int ledPin = 13; // the number of the LED pin
int buttonState = 0; // variable for reading the pushbutton status
void setup() {
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
pinMode(buttonPin, INPUT);
}
void loop(){
Serial.println("hi");
delay(1000);
buttonState = digitalRead(buttonPin);//1 HIGH 0 LOW
if (buttonState == HIGH) {
digitalWrite(ledPin, HIGH);
}
else {
digitalWrite(ledPin, LOW);
}
}
//ending
//processing begin final
回覆刪除import processing.serial.*;
Serial myPort; // Create object from Serial class
void setup() {
background(0);
println(Serial.list());
myPort = new Serial(this, "COM3", 9600);
}
void draw()
{
if (myPort.available()>0)
{
int rx = myPort.read();
println(rx);
if (rx == 104)
{
background(255, 0, 0);
}
if (rx == 105)
{
background(0, 0, 0);
}
}
// background(255,0,0);
}
void mousePressed()
{
background(0);
}
void keyPressed()
{
background(255, 0, 0);
}
//ending
//arduino final
回覆刪除const int buttonPin = 2; // the number of the pushbutton pin
const int ledPin = 13; // the number of the LED pin
int buttonState = 0; // variable for reading the pushbutton status
void setup() {
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
pinMode(buttonPin, INPUT);
}
void loop(){
buttonState = digitalRead(buttonPin);//1 HIGH 0 LOW
if (buttonState == HIGH) {
Serial.println("h");
delay(1000);
digitalWrite(ledPin, HIGH);
}
else {
Serial.println("i");
delay(1000);
digitalWrite(ledPin, LOW);
}
}
//ending