Difference between revisions of "CSC231 Lab 7"

From dftwiki3
Jump to: navigation, search
(New page: <!--Image:UnderConstruction.gif --> Back to CSC231 Weekly Schedule =CSC 231 Lab # 7= © D. Thiebaut, 2008 ==Input/Output PC to Arduino: Part I== In this fi...)
 
(Input/Output PC to Arduino: Part I)
Line 6: Line 6:
  
 
© D. Thiebaut, 2008
 
© D. Thiebaut, 2008
 +
 +
Before you start, you will need to setup the Ubuntu the same way we did in [[CSC231 Lab 6| Lab #6]], so that you are in the root folder of ubuntu, logged in as root, and you have copied your environment from the USB stick to your Ubuntu root account.
  
 
==Input/Output PC to Arduino: Part I==
 
==Input/Output PC to Arduino: Part I==
Line 13: Line 15:
 
Don't miss the presentation that will be done in class.  We'll go over the 3 programs involved in today's lab.
 
Don't miss the presentation that will be done in class.  We'll go over the 3 programs involved in today's lab.
  
First take a close look at the program that runs on the arduino: arduino_loop.pde, whose code is available [[CSC231 arduino_loop_new.pde]]
+
===The Arduino program: arduino_loop.pde===
 +
 
 +
* First take a close look at the program that runs on the arduino: arduino_loop.pde, whose code is available [[CSC231 arduino_loop_new.pde | '''here''']].  Notice how the loop function continuously store incoming characters in the buffer until a \n character is found, in which case the contents of the buffer is analyzed, the command identified, and executed.
 +
 
 +
* Cut and paste arduino_loop.pde in the '''arduino GUI''' on your '''Ubuntu''' machine.
 +
 
 +
* Compile it.
 +
 
 +
* Upload it to the Arduino.
 +
 
 +
===The C-Program running on the Ubuntu: arduino-serial.c===
 +
 
 +
* Take a close look at [[CSC231 Arduino-serial.c |''' arduino-serial.c''' ]].  It is the program running on the Ubuntu PC/laptop.  You should copy/paste it into an emacs window and save it to your

Revision as of 23:18, 6 November 2008

Back to CSC231 Weekly Schedule


CSC 231 Lab # 7

© D. Thiebaut, 2008

Before you start, you will need to setup the Ubuntu the same way we did in Lab #6, so that you are in the root folder of ubuntu, logged in as root, and you have copied your environment from the USB stick to your Ubuntu root account.

Input/Output PC to Arduino: Part I

In this first part you will enter commands at the Linux prompt to set the Arduino LED 13 On and Off, or to read the status of various pins.

Don't miss the presentation that will be done in class. We'll go over the 3 programs involved in today's lab.

The Arduino program: arduino_loop.pde

  • First take a close look at the program that runs on the arduino: arduino_loop.pde, whose code is available here. Notice how the loop function continuously store incoming characters in the buffer until a \n character is found, in which case the contents of the buffer is analyzed, the command identified, and executed.
  • Cut and paste arduino_loop.pde in the arduino GUI on your Ubuntu machine.
  • Compile it.
  • Upload it to the Arduino.

The C-Program running on the Ubuntu: arduino-serial.c

  • Take a close look at arduino-serial.c . It is the program running on the Ubuntu PC/laptop. You should copy/paste it into an emacs window and save it to your