블로그 이미지
Leeway is... the freedom that someone has to take the action they want to or to change their plans.
maetel

Notice

Recent Post

Recent Comment

Recent Trackback

Archive

calendar

1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
  • total
  • today
  • yesterday

Category

2007. 1. 3. 05:09 Hardware

Wiring

void setup() {
  Serial.begin(38400);
}

void loop() {
  if (Serial.real() == 65) {
    Serial.print((analogRead(0)/4));
    Serial.print((analogRead(1)/4));
    Serial.print((analogRead(2)/4));


Processing

import processing.serial.*;
Serial port;
float xpos;

void setup() {
  size(256,256);
  noStroke();
  println(Serial.list());
  port = new Serial(this, Serial.list()[2], 38400);
//  port.clear();
}
void draw(){
 
background(0);
while (port.available() > 0) {
  xpos = port.read();
}
rect(xpos,100,20,20);
}


Wiring

int ax = 0; //set the pin number
int ay = 1;
int az = 2;
int x = 0; //the value of acceleration on x-axis
int y = 0;
int z = 0;

void setup() {
  Serial.begin(38400);
}

void loop() {
  x = analogRead(ax); //read the value of analog pin 0
  y = analogRead(ay);
  z = analogRead(az);
  Serial.print(x/4);
  Serial.print(y/4);
  Serial.print(z/4); //write the scaled value to the serial port
}


 

된장... shielding... orz

'Hardware' 카테고리의 다른 글

[Noah Shibley] eagle PCB  (0) 2008.04.01
smd toast oven  (0) 2008.03.24
soldering  (0) 2006.12.14
testing serial  (0) 2006.12.10
hardware term  (0) 2006.02.21
posted by maetel