Show Posts
Pages: [1]
1  Topics / Robotics / Re: ask: communication arduino with tcp winsock!!!!!!!! on: November 27, 2011, 03:26:13 am
Code:
// Arduino firmware for Android Robot Project
// Command:   X  F  B  L  R  FR    FL    BR   BL    H
// PORT_map:  -  1  2  4  8   9     5    10   6     16 (PORTB HEX)
// Received:  0  1  2  3  4   5     6    7    8     9  (from router)
// Pin        -  8  9  10 11  811   810  911  910   12

unsigned char port_map[10]={0,1,2,4,8,9,5,10,6,16};
unsigned int in_char;
unsigned long counter=0;
unsigned char in_byte=0;
unsigned int test=0;

void setup()
{
  DDRB=B11111111; //PORTB as OUTPUT
  Serial.begin(9600); //Start Serial
}
char recv_char()
{
  while (counter < 15000) //Pulse of command
  {
    counter++;
    if (Serial.available() > 0)
    {
      in_byte = Serial.read();
      test=(int)in_byte-48;
      Serial.print(test);
      counter = 0;
      return test;
    }
  }
  counter=0;
  return 0;
}
void loop()
{
  in_char=recv_char();
  PORTB=port_map[in_char]; //Port map
}


just read the algoritme brother

i think it was clearly
2  Topics / Robotics / ask: communication arduino with tcp winsock!!!!!!!! on: November 25, 2011, 03:25:41 am
all my dear friends
help me
i get code
Code:
// Arduino firmware for Andriod Robot Project
// Command:   X  F  B  L  R  FR    FL    BR   BL    H
// PORT_map:  -  1  2  4  8   9     5    10   6     16 (PORTB HEX)
// Received:  0  1  2  3  4   5     6    7    8     9  (from router)
// Pin        -  8  9  10 11  811   810  911  910   12

unsigned char port_map[10]={0,1,2,4,8,9,5,10,6,16};
unsigned int in_char;
unsigned long counter=0;
unsigned char in_byte=0;
unsigned int test=0;
void setup()
{
DDRB=B11111111; //PORTB as OUTPUT
Serial.begin(9600); //Start Serial
} char recv_char()
{
while (counter < 15000) //Pulse of command
{
counter++;
if (Serial.available() > 0)
{
in_byte = Serial.read();
test=(int)in_byte-48;
Serial.print(test);
counter = 0;
return test;
            }
}
counter=0;
return 0;
} void loop()
{
in_char=recv_char();
PORTB=port_map[in_char]; //Port map
}


my goal to communication arduino and tcp socket linksys ddwrt to control motor dc
looks like well .. but i can control device correct...
what is that corrcetlly code ... or .. i have some missing code .. to communication well drive motor dc

3  Topics / Robotics / ask: communication arduino with tcp winsock!!!!!!!! on: November 25, 2011, 03:23:56 am
all my dear friends
help me
i get code
Code:
// Arduino firmware for Andriod Robot Project
// Command:   X  F  B  L  R  FR    FL    BR   BL    H
// PORT_map:  -  1  2  4  8   9     5    10   6     16 (PORTB HEX)
// Received:  0  1  2  3  4   5     6    7    8     9  (from router)
// Pin        -  8  9  10 11  811   810  911  910   12

unsigned char port_map[10]={0,1,2,4,8,9,5,10,6,16};
unsigned int in_char;
unsigned long counter=0;
unsigned char in_byte=0;
unsigned int test=0;
void setup()
{
DDRB=B11111111; //PORTB as OUTPUT
Serial.begin(9600); //Start Serial
} char recv_char()
{
while (counter < 15000) //Pulse of command
{
counter++;
if (Serial.available() > 0)
{
in_byte = Serial.read();
test=(int)in_byte-48;
Serial.print(test);
counter = 0;
return test;
            }
}
counter=0;
return 0;
} void loop()
{
in_char=recv_char();
PORTB=port_map[in_char]; //Port map
}


my goal to communication arduino and tcp socket linksys ddwrt to control motor dc
looks like well .. but i can control device correct...
what is that corrcetlly code ... or .. i have some missing code .. to communication well drive motor dc
4  Using Arduino / Motors, Mechanics, and Power / ask: communication arduino with tcp winsock!!!!!!!!111 on: November 25, 2011, 03:21:21 am
all my dear friends
help me
i get code
Code:
// Command:   X  F  B  L  R  FR    FL    BR   BL    H
// PORT_map:  -  1  2  4  8   9     5    10   6     16 (PORTB HEX)
// Received:  0  1  2  3  4   5     6    7    8     9  (from router)
// Pin        -  8  9  10 11  811   810  911  910   12

unsigned char port_map[10]={0,1,2,4,8,9,5,10,6,16};
unsigned int in_char;
unsigned long counter=0;
unsigned char in_byte=0;
unsigned int test=0;
void setup()
{
DDRB=B11111111; //PORTB as OUTPUT
Serial.begin(9600); //Start Serial
} char recv_char()
{
while (counter < 15000) //Pulse of command
{
counter++;
if (Serial.available() > 0)
{
in_byte = Serial.read();
test=(int)in_byte-48;
Serial.print(test);
counter = 0;
return test;
            }
}
counter=0;
return 0;
} void loop()
{
in_char=recv_char();
PORTB=port_map[in_char]; //Port map
}

my goal to communication arduino and tcp socket linksys ddwrt to control motor dc
looks like well .. but i can control device correct...
what is that corrcetlly code ... or .. i have some missing code .. to communication well drive motor dc
Pages: [1]