Koa-PicoITX User Manual rev 1.0
17
Figure 4.1: koala_test.c source code
For this file, you must change the serial port in the libkorebot configuration
files. Edit it with the following command on the Koa-PicoITX:
sudo gedit /etc/libkorebot/Koala.knc
Change the line
device Robot rs232 /dev/tts/2
to
device Robot rs232 /dev/ttyUSB0
Then execute the program with: sudo ./koala_test
••••
digital inputs outputs: gpio_test.c
••••
additional motors: kmotLE_test.c
••••
pan-tilt camera: kmotLE_pantilt.c
//
koala_test.c
#include <korebot/korebot.h>
int main( int argc , char * argv[] )
{
knet_dev_t *koala;
int rc;
unsigned char buf[16];
unsigned char a,b,c,d;
kb_set_debug_level( 2 );
if((rc = kb_init( argc , argv )) < 0 )
return 1;
koala = knet_open( "Koala:Robot", KNET_BUS_ANY, 0 , NULL );
if(!koala)
printf("Open failed\r\n");
koa_getOSVersion(koala,&a,&b,&c,&d);
printf("OS revision %d.%d protocol %d.%d\r\n",a,b,c,d);
koa_setSpeed(koala,10,10);
sleep(1);
koa_setSpeed(koala,-10,-10);
sleep(1);
koa_setSpeed(koala,0,0);
kb_config_exit();
return 0;
}