[PD-cvs] externals/hardware/arduino/examples/Pd_Input Pd_Input.pde, 1.1, 1.2

Hans-Christoph Steiner eighthave at users.sourceforge.net
Sat Mar 11 05:35:38 CET 2006


Update of /cvsroot/pure-data/externals/hardware/arduino/examples/Pd_Input
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27679/Pd_Input

Modified Files:
	Pd_Input.pde 
Log Message:
got the firmware for the high-speed protocol sketched out, now I need to figure out the div/mod byte format

Index: Pd_Input.pde
===================================================================
RCS file: /cvsroot/pure-data/externals/hardware/arduino/examples/Pd_Input/Pd_Input.pde,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Pd_Input.pde	5 Mar 2006 06:48:01 -0000	1.1
--- Pd_Input.pde	11 Mar 2006 04:35:36 -0000	1.2
***************
*** 2,14 ****
   * ------------------
   *
!  * This program reads all of the Analog inputs
!  * and sends the data to the computer as fast as
!  * possible.  It was designed to work with the Pd
!  * patch of the same name in:
!  * Help -> Browser -> examples -> hardware
   *
   * (cleft) 2006 Hans-Christoph Steiner
   * @author: Hans-Christoph Steiner
!  * @date: 2006-03-04
   * @location: Polytechnic University, Brooklyn, New York, USA
   */
--- 2,17 ----
   * ------------------
   *
!  * This program reads all of the Analog and 12 Digital Inputs
!  * and sends the data to the computer as fast as possible.  
!  * It reads one analog pin and two digital pins per cycle 
!  * so that the time between reads on all pins remains 
!  * constant.
!  *
!  * It was designed to work with the Pd patch of the same 
!  * name in:  Help -> Browser -> examples -> hardware
   *
   * (cleft) 2006 Hans-Christoph Steiner
   * @author: Hans-Christoph Steiner
!  * @date: 2006-03-10
   * @location: Polytechnic University, Brooklyn, New York, USA
   */
***************
*** 20,33 ****
   */
      
! int potPin = 0;
  void setup() {
!   beginSerial(19200);
  }
  
  void loop() {
!   printByte(potPin + 65); // add 65 to get ASCII chars starting with A
!   printInteger(analogRead(potPin));
!   potPin = potPin + 1;
!   if (potPin > 5)
!     potPin = 0;
  }
--- 23,64 ----
   */
      
! int analogPin = 0;
! int digitalPin = 0;
! int ledOut = 1;
! int analogIn = 0;
  void setup() {
!   beginSerial(9600);
  }
  
  void loop() {
!   /*
!    * get two digital ins
!    */
! /*   
!   printByte(digitalRead(digitalPin));
!   digitalPin = digitalPin + 1;
!   if (digitalPin > 11)
!     digitalPin = 0;
!   printByte(digitalRead(digitalPin));
!   digitalPin = digitalPin + 1;
!   if (digitalPin > 11)
!     digitalPin = 0;
! */
!   /*
!    * get analog in
!    */
!   printByte(65);   
!   analogIn = analogRead(analogPin);
!   printByte(analogIn / 127);
!   printByte(analogIn % 127);
!   analogPin = analogPin + 1;
!   if (analogPin > 5)
!   {
!     analogPin = 0;
!     // toggle the status LED (pin 13)
!     digitalWrite(13,ledOut);
!     ledOut = !ledOut;  // alternate the LED
!     // the newline (ASCII 10) marks the start/end of the sequence
!     printNewline();   
!   }  
  }





More information about the Pd-cvs mailing list