#Basic code
clg
graphsize 500,500
font "arial",10,100
openserial 1, "COM3"
x=250
y=250
dx=0
dy=0
for a = 1 to 90000
n=asc (read(1))
if int (n/10)=1 then dx=-1
if int (n/10)=2 then dx=0
if int (n/10)=3 then dx=1
if int (n/10)=4 then dy=-1
if int (n/10)=5 then dy=0
if int (n/10)=6 then dy=1
x=x-dx
y=y+dy
circle x, y,2
next a
// Arduino code
int x = 0;
int y = 0;
int F = 0;
void setup()
{ Serial.begin(9600);
}
void loop()
{
x = map(analogRead(1),0,1023,15,35);
y = map(analogRead(2),0,1023,45,65);
F = map(analogRead(0),0,1023,78,88);
Serial.write(x);
delay(10);
Serial.write(y);
delay(10);
Serial.write(F);
delay(10);
}
clg
graphsize 500,500
font "arial",10,100
openserial 1, "COM3"
x=250
y=250
dx=0
dy=0
for a = 1 to 90000
n=asc (read(1))
if int (n/10)=1 then dx=-1
if int (n/10)=2 then dx=0
if int (n/10)=3 then dx=1
if int (n/10)=4 then dy=-1
if int (n/10)=5 then dy=0
if int (n/10)=6 then dy=1
x=x-dx
y=y+dy
circle x, y,2
next a
// Arduino code
int x = 0;
int y = 0;
int F = 0;
void setup()
{ Serial.begin(9600);
}
void loop()
{
x = map(analogRead(1),0,1023,15,35);
y = map(analogRead(2),0,1023,45,65);
F = map(analogRead(0),0,1023,78,88);
Serial.write(x);
delay(10);
Serial.write(y);
delay(10);
Serial.write(F);
delay(10);
}
No comments:
Post a Comment