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

Hans-Christoph Steiner eighthave at users.sourceforge.net
Tue Mar 14 23:31:41 CET 2006


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

Modified Files:
	Pd_Input.pde 
Log Message:
got the basics of the byte-based speedy firmware working, now I got to get the Pd patch working with this firmware

Index: Pd_Input.pde
===================================================================
RCS file: /cvsroot/pure-data/externals/hardware/arduino/examples/Pd_Input/Pd_Input.pde,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Pd_Input.pde	11 Mar 2006 04:35:36 -0000	1.2
--- Pd_Input.pde	14 Mar 2006 22:31:39 -0000	1.3
***************
*** 23,30 ****
   */
      
  int analogPin = 0;
  int digitalPin = 0;
  int ledOut = 1;
! int analogIn = 0;
  void setup() {
    beginSerial(9600);
--- 23,33 ----
   */
      
+ int i;
  int analogPin = 0;
  int digitalPin = 0;
  int ledOut = 1;
! int analogData = 0;
! int digitalData = 0;
! int digitalOutputByte = 0;
  void setup() {
    beginSerial(9600);
***************
*** 34,55 ****
    /*
     * 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)
--- 37,62 ----
    /*
     * get two digital ins
!    */ 
!   digitalOutputByte = 0;
!   for(i=0;i<7;++i)
!   {
!     digitalData = digitalRead(i);
!     digitalOutputByte = digitalOutputByte + (2^(i+1)*digitalData);
!   }
!   printByte(digitalOutputByte);
!   digitalOutputByte = 0;
!   for(i=7;i<13;++i)
!   {
!     digitalData = digitalRead(i);
!     digitalOutputByte = digitalOutputByte + (2^(i-6)*digitalData);
!   }
!   printByte(digitalOutputByte);
    /*
     * get analog in
     */
!   analogData = analogRead(analogPin);
!   // these two bytes get converted back into the whole number in Pd
!   printByte(analogData / 32);  // div by 32 for the big byte
!   printByte(analogData % 32);  // mod by 32 for the small byte
    analogPin = analogPin + 1;
    if (analogPin > 5)
***************
*** 60,64 ****
      ledOut = !ledOut;  // alternate the LED
      // the newline (ASCII 10) marks the start/end of the sequence
!     printNewline();   
    }  
  }
--- 67,71 ----
      ledOut = !ledOut;  // alternate the LED
      // the newline (ASCII 10) marks the start/end of the sequence
!     printByte(255);   
    }  
  }





More information about the Pd-cvs mailing list