IPAB Neuromorphic / Mbed 2 deprecated Koala_test

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "Koala.h"
00003 
00004 
00005 Serial PC(USBTX,USBRX);
00006 Koala koala(p28,p27,38400);  // tx, rx, baudrate
00007 
00008 // Just to check different speeds.
00009 #define SPEED   3
00010 #define LS      3
00011 #define RS     -5
00012 
00013 
00014 int main() {
00015 
00016     PC.baud(38400);
00017 
00018     PC.printf("\r\nKoala Test Code\r\n");
00019     PC.printf("=================================\r\n");
00020     PC.printf("Initialising...\r\n");
00021 
00022 
00023     PC.printf("Initialising position (0,0)\r\n%c\r\n",koala.set_pos_cnt(0,0));
00024 
00025     PC.printf("Moving with speed (%d,%d)\r\n%c\r\n",LS*SPEED,RS*SPEED,koala.set_speed(LS*SPEED,RS*SPEED));
00026     wait(2);
00027     PC.printf("Stop moving...\r\n%c\r\n",koala.set_speed(0,0));
00028     wait(0.5);
00029 
00030     int nCountL,nCountR;
00031     koala.read_position(&nCountL,&nCountR);
00032     PC.printf("Counts:\t%d\t%d\r\n",nCountL,nCountR);
00033     wait(1);
00034 
00035     /* Read channel input
00036     for (int i=0;i<1000;i++) {
00037 
00038         PC.printf("Ears:\t%d\t%d\r\n",koala.read_channel(0),koala.read_channel(1));
00039     }
00040     */
00041 }