View Basic Stamp debug in linux terminal
idlepoze
Posts: 2
Hi, I've currently bought the Basic Stamp Discovery Kit to learn and play around with. I'm using Ubuntu 13.10 and VirtualBox to emulate Windows XP to run the Basic Stamp Editor, which works great.
But I had an idea to to make a program in linux that can read the debug commands sent from the Basic Stamp microcontroller. I have so far written a small C++ program to open the usb port and looking at the data recieved. Since I'm new to all of this I was hoping that somebody could point me in the right direction. The program so far initiates the program written into the EEPROM and recieves data which is all scrambled. I'm guessing here that it has something to do with ASCII encoding or HEX but not quite sure if I need to understand more about how the usb sends data or how Basic stamp sends information.
My basic stamp program looks like this (It sets the servo to 45 degrees for 3 seconds)
And my C++ code looks like this, which I compile with "g++ main.cpp -o main" and then run with ./main
But I had an idea to to make a program in linux that can read the debug commands sent from the Basic Stamp microcontroller. I have so far written a small C++ program to open the usb port and looking at the data recieved. Since I'm new to all of this I was hoping that somebody could point me in the right direction. The program so far initiates the program written into the EEPROM and recieves data which is all scrambled. I'm guessing here that it has something to do with ASCII encoding or HEX but not quite sure if I need to understand more about how the usb sends data or how Basic stamp sends information.
My basic stamp program looks like this (It sets the servo to 45 degrees for 3 seconds)
' {STAMP BS2} ' {PBASIC 2.5} DEBUG "Program Running!", CR counter VAR Word DEBUG "Position = 45 degrees...", CR FOR counter = 1 TO 150 PULSOUT 14,500 PAUSE 20 NEXT END
And my C++ code looks like this, which I compile with "g++ main.cpp -o main" and then run with ./main
#include <iostream> #include <fstream> using namespace std; std::string str; int main() { fstream f; f.open("/dev/ttyUSB0"); while(true) { while(f >> str) { cout << str; } } return 0; }
Comments