Simple wireless serial test using a pair of Pololu Wixels. Uses m3pi as a convenient dev board, since it is prewired for a Wixel.
main.cpp
00001 #include "mbed.h" 00002 #include "m3pi.h" 00003 00004 // Quick test for a pair of Pololu Wixels, both configured with Wireless Serial App (download from Pololu) 00005 00006 // m3pi Robot is used as a convenient dev board, since it has a socket for a Wixel already, and connects 00007 // to the Wixel on pins 28/27/26 (Tx/Rx/nReset). 00008 00009 // Note the nReset is optional, and the code works without it (thanks to internal pullup resistors). 00010 // However, don't declare p26 as a Digital output unless you plan to use it as the Wixel nReset, in which case 00011 // you need to drive it high to bring the Wixel out of reset. 00012 00013 m3pi m3pi; 00014 Serial Wixel(p28, p27); // tx, rx 00015 Serial PC(USBTX, USBRX); 00016 //DigitalOut Wixel_nReset(p26); // don't declare unless you want nReset capability 00017 00018 int main() 00019 { 00020 m3pi.locate(0,0); 00021 m3pi.printf("Wixel!"); // need to send something to the m3pi just to stop it running the demo app... 00022 //Wixel_nReset = 1; // take the Wixel out of reset 00023 Wixel.baud(9600); // Wixel default baud rate (can configure other rates via Wixel config app...) 00024 while(1) 00025 { 00026 Wixel.printf("Hello Wixel\r\n"); 00027 while (Wixel.readable()) 00028 { 00029 PC.putc(Wixel.getc()); 00030 } 00031 wait_ms(1000); 00032 } 00033 }
Generated on Thu Jul 21 2022 13:23:57 by 1.7.2