<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
      <title>Tagged with analogwrite() - Processing 2.x and 3.x Forum</title>
      <link>https://forum.processing.org/two/discussions/tagged/feed.rss?Tag=analogwrite%28%29</link>
      <pubDate>Sun, 08 Aug 2021 18:38:38 +0000</pubDate>
         <description>Tagged with analogwrite() - Processing 2.x and 3.x Forum</description>
   <language>en-CA</language>
   <atom:link href="/two/discussions/taggedanalogwrite%28%29/feed.rss" rel="self" type="application/rss+xml" />
   <item>
      <title>How to send multiple PWM values from Processing to Arduino?</title>
      <link>https://forum.processing.org/two/discussion/24916/how-to-send-multiple-pwm-values-from-processing-to-arduino</link>
      <pubDate>Wed, 08 Nov 2017 17:42:34 +0000</pubDate>
      <dc:creator>hoodihoo</dc:creator>
      <guid isPermaLink="false">24916@/two/discussions</guid>
      <description><![CDATA[<p>Hi all,</p>

<p>For a while I've been looking to control several banks of LED lights independently by using a GUI with a couple sliding bars. The idea is by moving each sliding bar around, the PWM value of the corresponding LED bank would change and the LEDs would get brighter or darker. Through this forum and other resources I have been able to accomplish this with one slider bar and one bank of LEDs. However, I am struggling to scale this project up because I don't know how to send and read multiple PWM values from several slider bars. I've seen some people mentioning splitting up the communication into several bits and then reading each bit in Arduino to correspond to each LED bank. I do not know how to accomplish this with the slider bars though. If you do have a solution, please by thorough. My Processing and Arduino code is below (currently aimed at using 2 slider bars for 2 corresponding LED banks), thanks in advance.</p>

<p><strong>Processing</strong></p>

<pre><code>import controlP5.*;

import processing.serial.*;

ControlP5 cp5;

Serial port;

PFont font, font2;


int Brightness_1 = 0;

int Brightness_2 = 0;

void setup() 
{

 size(450, 200);

 String portName = Serial.list()[0];

 port = new Serial(this, "COM9", 9600);

  cp5 = new ControlP5(this);

 font = createFont("calibri light", 20);

 font2 = createFont("calibri light", 12);

  cp5.addSlider("Brightness_1", 0, 255, 0, 50, 125, 255, 12)
     .setPosition(50,125)
     .setSize(255,12)
     .setRange(0,255)
     .setFont(font);

  cp5.addSlider("Brightness_2", 0, 255, 0, 50, 125, 255, 12)
     .setPosition(50,125)
     .setSize(255,12)
     .setRange(0,255)
     .setFont(font);
}

void draw() 
{
  background(200, 10, 30);
  fill(100, 0, 150);
  textFont(font);

  text(Brightness_1, 25, 50);

  port.write(Brightness_1);

  port.write(Brightness_2);



}
</code></pre>

<p><strong>Arduino</strong></p>

<pre><code>int incomingData;

void setup()
{

pinMode(4, OUTPUT);   //set pin4 as output 

pinMode(5, OUTPUT);   //set pin5 as output 

//pinMode(6, OUTPUT);   //set pin6 as output

Serial.begin(9600);

}

void loop()
{
if(Serial.available())

 {
    incomingData = Serial.read();

    analogWrite(4, incomingData);

    analogWrite(5, incomingData);

      }


  }
</code></pre>
]]></description>
   </item>
   <item>
      <title>how to control 20 RC servo motors using Arduino mega</title>
      <link>https://forum.processing.org/two/discussion/21007/how-to-control-20-rc-servo-motors-using-arduino-mega</link>
      <pubDate>Sat, 25 Feb 2017 18:40:17 +0000</pubDate>
      <dc:creator>godbol</dc:creator>
      <guid isPermaLink="false">21007@/two/discussions</guid>
      <description><![CDATA[<p>HI Guys,</p>

<p>1.I am working on a project where i need to run 20 RC servo motors in a set of 4 consist of 5 motors each.</p>

<p>2.The logic here is each set has to run by specific angle based on pc system time(H1H2:M1M2).
  ranges for H1[0-2], H2 [0-9], M1[0-5],M2[0-9].say the time is 23:47, for the value of H1(2) one set of motor will run by 70 degrees
  and for H2(3) second set of motor will run by 35 degree.similarly for M1(4) third set and M2(7) forth set.</p>

<p>3.my challenge here is to control 20 servos.Am using PWM pins on arduino mega by uploading servo lib.
  my mega has only 12 PWM pins[2-13]. [44,45,46] are not working as PWM but working as digital.
  Thus i can control only 12.</p>

<p>Eg. <code>arduino.analogWrite([pin 2-13], angle);</code></p>

<p>4.i have also tried       arduino.pinMode(pin[22-53], Arduino.SERVO);
                                   arduino.servoWrite(pin[22-53],90);
  but it does pin%16 and runs the reminder pin no. if it exists.</p>

<p>Eg. <code>arduino.pinMode(pin[39], Arduino.SERVO); //39%16=7(runs PWM pin 7)</code>
      <code>arduino.pinMode(pin[44], Arduino.SERVO); //44%16=12(runs PWM pin 12)</code></p>

<p>5.Please note in the below code i have marked pin no 14-17 for representations purpose only to display H1. These pins do not work for servos.</p>

<p>6.please suggest any solution as how to control the rest of the servo motors. I want to keep the code as simple as possible.</p>

<p>below is the processing code:</p>

<pre lang="c"> 

import processing.serial.*;
import cc.arduino.*;
 
Arduino arduino;
int h;
int m;
int s;
int h1;
int h2;
int m1;
int m2;
int s1;
int s2; 
int aftr_m1=99;
int aftr_m2=99;
int aftr_h1=99;
int aftr_h2=99;
int pin=34;
void setup()
{

  // Prints out the available serial ports.
  println(Arduino.list());
  
  
  arduino = new Arduino(this, Arduino.list()[2], 57600);

  
}
void disp_hour(int v_h1,int v_h2)
{

 if (aftr_h1!=v_h1)
 {
   //tens position of hour(H1) arduino pin[14-17]
  if(v_h1==0){  
        arduino.analogWrite(14, 10);arduino.analogWrite(15, 90);
        arduino.analogWrite(16, 90);arduino.analogWrite(17, 90);
         }

  if(v_h1==1){ 
        arduino.analogWrite(14, 90);arduino.analogWrite(15, 10);
        arduino.analogWrite(16, 10);arduino.analogWrite(17, 10); 
         }
  
  if(v_h1==2){ 
        arduino.analogWrite(14, 90);arduino.analogWrite(15, 10);
        arduino.analogWrite(16, 10);arduino.analogWrite(17, 90); 
         }
  
  aftr_h1=v_h1;
 }

 if (aftr_h2!=v_h2)
 {
   //once position of hour(H2) arduino pin[10-13]
  if(v_h2==0){ 
        arduino.analogWrite(10, 10);arduino.analogWrite(11, 90);
        arduino.analogWrite(12, 90);arduino.analogWrite(13, 90); 
         }
  
  if(v_h2==1){ 
        arduino.analogWrite(10, 90);arduino.analogWrite(11, 10);
        arduino.analogWrite(12, 10);arduino.analogWrite(13, 10); 
         }
  
  if(v_h2==2){ 
        arduino.analogWrite(10, 90);arduino.analogWrite(11, 10);
        arduino.analogWrite(12, 10);arduino.analogWrite(13, 90); 
         }

  aftr_h2=v_h2;
  
 }

}
void disp_min(int v_m1,int v_m2)
{

 if (aftr_m1!=v_m1)
 {
  //tens position of minute(M1) arduino pin[2-5]
  if(v_m1==0){ 
        arduino.analogWrite(2, 10);arduino.analogWrite(3, 90);
        arduino.analogWrite(4, 90);arduino.analogWrite(5, 90); 
         }
  
  if(v_m1==1){ 
        arduino.analogWrite(2, 90);arduino.analogWrite(3, 10);
        arduino.analogWrite(4, 10);arduino.analogWrite(5, 10); 
         }
  
  if(v_m1==2){ 
        arduino.analogWrite(2, 90);arduino.analogWrite(3, 10);
        arduino.analogWrite(4, 10);arduino.analogWrite(5, 90); 
         }

  aftr_m1=v_m1;
 }

 if (aftr_m2!=v_m2)
 {
  //once position of minute(M2) arduino pin[6-9]
  if(v_m2==0){ 
        arduino.analogWrite(6, 10);arduino.analogWrite(7, 90);
        arduino.analogWrite(8, 90);arduino.analogWrite(9, 90); 
         }
  
  if(v_m2==1){ 
        arduino.analogWrite(6, 90);arduino.analogWrite(7, 10);
        arduino.analogWrite(8, 10);arduino.analogWrite(9, 10); 
         }
  
  if(v_m2==2){ 
        arduino.analogWrite(6, 90);arduino.analogWrite(7, 10);
        arduino.analogWrite(8, 10);arduino.analogWrite(9, 90); 
         }
  
  aftr_m2=v_m2;
  
 }
}

void draw ()
{


h=hour();
h2=int(h%10);
h1=int(h/10);

m=minute();
m2=int(m%10);
m1=int(m/10);

s=second();
s2=int(s%10);
s1=int(s/10);

//println("m1:m2 ",m1+":"+m2);
disp_min(m1,m2);//pass tens,once place for minutes
disp_hour(h1,h2);//pass tens,once place for hour

//test
delay(2000);
arduino.servoWrite(pin,0);    //pin=34, 34%16 = 2, PWM pin 2 runs
delay(2000);
arduino.servoWrite(pin,90);

}

</pre>

<p>thanks.</p>
]]></description>
   </item>
   <item>
      <title>Arduino -&gt; Processing conversion: creating mux channels</title>
      <link>https://forum.processing.org/two/discussion/21737/arduino-processing-conversion-creating-mux-channels</link>
      <pubDate>Fri, 31 Mar 2017 19:15:14 +0000</pubDate>
      <dc:creator>narner</dc:creator>
      <guid isPermaLink="false">21737@/two/discussions</guid>
      <description><![CDATA[<p>As the title alludes to, I'm in the process of converting an Arduino sketch to a Processing sketch. So far, mostly pretty straightforward.</p>

<p>I'm running into an issue with creating an array of ints for the channels for two muxers. Below is the code that I currently have working for the Arduino sketch:</p>

<pre><code>int writeMux(int channel){
  int controlPin[] = {s0, s1, s2, s3, s4, s5, s6, s7};

  int muxChannel[20][8]={
    //Mux 1 
    {0,0,0,0,0,0,0,0}, //channel 0
    {1,0,0,0,0,0,0,0}, //channel 1
    {0,1,0,0,0,0,0,0}, //channel 2
    {1,1,0,0,0,0,0,0}, //channel 3
    {0,0,1,0,0,0,0,0}, //channel 4
    {1,0,1,0,0,0,0,0}, //channel 5
    {0,1,1,0,0,0,0,0}, //channel 6
    {1,1,1,0,0,0,0,0}, //channel 7
    {0,0,0,1,0,0,0,0}, //channel 8
    {1,0,0,1,0,0,0,0}, //channel 9

    //Max 2
    {1,1,1,1,0,0,0,0}, //channel 0
    {1,1,1,1,1,0,0,0}, //channel 1
    {1,1,1,1,0,1,0,0}, //channel 2
    {1,1,1,1,1,1,0,0}, //channel 3
    {1,1,1,1,0,0,1,0}, //channel 4
    {1,1,1,1,1,0,1,0}, //channel 5
    {1,1,1,1,0,1,1,0}, //channel 6
    {1,1,1,1,1,1,1,0}, //channel 7
    {1,1,1,1,0,0,0,1}, //channel 8
    {1,1,1,1,1,0,0,1}, //channel 9
  }; 

  //loop through the 4 sig
  for(int i = 0; i &lt; 8; i ++){
    digitalWrite(controlPin[i], muxChannel[channel][i]);
  }

  //write the value at the SIG pin
  analogWrite(SIG_pin, testValue);  

  //return the value
  return 0;
}
</code></pre>

<p>Below is the slightly varied version that I'm using for my Processing-equivelent sketch.</p>

<pre><code>int readMux(int channel){
  int controlPin[] = {s0, s1, s2, s3};

  int muxChannel[20][8]={
    //Mux 1 
    {0,0,0,0,0,0,0,0}, //channel 0
    {1,0,0,0,0,0,0,0}, //channel 1
    {0,1,0,0,0,0,0,0}, //channel 2
    {1,1,0,0,0,0,0,0}, //channel 3
    {0,0,1,0,0,0,0,0}, //channel 4
    {1,0,1,0,0,0,0,0}, //channel 5
    {0,1,1,0,0,0,0,0}, //channel 6
    {1,1,1,0,0,0,0,0}, //channel 7
    {0,0,0,1,0,0,0,0}, //channel 8
    {1,0,0,1,0,0,0,0}, //channel 9

    //Max 2
    {1,1,1,1,0,0,0,0}, //channel 0
    {1,1,1,1,1,0,0,0}, //channel 1
    {1,1,1,1,0,1,0,0}, //channel 2
    {1,1,1,1,1,1,0,0}, //channel 3
    {1,1,1,1,0,0,1,0}, //channel 4
    {1,1,1,1,1,0,1,0}, //channel 5
    {1,1,1,1,0,1,1,0}, //channel 6
    {1,1,1,1,1,1,1,0}, //channel 7
    {1,1,1,1,0,0,0,1}, //channel 8
    {1,1,1,1,1,0,0,1}, //channel 9
  }; 


  //loop through the 4 sig
  for(int i = 0; i &lt; 4; i ++){
    digitalWrite(controlPin[i], muxChannel[channel][i]);
  }

  //write the value at the SIG pin
  arduino.analogWrite(SIG_pin, testValue);  

  int val = 0;
  return val;
}
</code></pre>

<p>I'm currently getting an error of unexpected token: int error at the following line:</p>

<pre><code>  int muxChannel[20][8]={
</code></pre>

<p>And, an error of <code>The type of expression must be an array type but it resolved to int at this line</code>:</p>

<pre><code>digitalWrite(controlPin[i], muxChannel[channel][i]);
</code></pre>

<p>I'm by no means a Java expert, so I'm not exactly sure what's going on. Anyone able to offer some insight?</p>

<p>Thank you!</p>
]]></description>
   </item>
   <item>
      <title>Change colors when mouse is over forms</title>
      <link>https://forum.processing.org/two/discussion/18627/change-colors-when-mouse-is-over-forms</link>
      <pubDate>Wed, 19 Oct 2016 19:04:19 +0000</pubDate>
      <dc:creator>roosmarijn</dc:creator>
      <guid isPermaLink="false">18627@/two/discussions</guid>
      <description><![CDATA[<p>Hi,
I want three squares and when I go over the first one, i want all of them to turn red and to send a letter to arduino, when I go over the second one, I want all of them to turn green and when I go over the third one with my mouse, I want all of them to turn blue. When I click outside the boxes, I want all of them to turn black. Ony the R, G and B color changing part isn't working. Can someone help me with this?</p>

<pre><code>import processing.net.*;
import processing.serial.*;
Serial myPort;
int click =0;
int box =0;

void setup () {
  size ( 640, 200);
  background (130);
  String portName = "COM5";
  myPort = new Serial (this, portName, 9600);
}

void draw () {
  drawFigures();
}
void loop () {   

  if (mouseOverRect1() == true) {  // If mouse is over square,
    fill(255, 20, 20);         // change color and
    drawFigures();
    myPort.write('R');              // send an R to indicate mouse is over square 1
  }  
  if (mouseOverRect2() == true) {  // If mouse is over square,
    fill(20, 255, 20);           // change color and
    drawFigures();
    myPort.write('G');              // send an G to indicate mouse is over square 2
  } 
  if (mouseOverRect3() == true) {  // If mouse is over square,
    fill(20, 20, 255);                    // change color and
    drawFigures();
    myPort.write('B');              // send an B to indicate mouse is over square 3
  }
}

boolean mouseOverRect1() { // Test if mouse is over square 1
  return ((mouseX &gt;= 10) &amp;&amp; (mouseX &lt;= 190) &amp;&amp; (mouseY &gt;= 10) &amp;&amp; (mouseY &lt;= 190));
}
boolean mouseOverRect2() { // Test if mouse is over square 2
  return ((mouseX &gt;= 230) &amp;&amp; (mouseX &lt;= 420) &amp;&amp; (mouseY &gt;= 10) &amp;&amp; (mouseY &lt;= 190));
}
boolean mouseOverRect3() { // Test if mouse is over square 3
  return ((mouseX &gt;= 450) &amp;&amp; (mouseX &lt;= 630) &amp;&amp; (mouseY &gt;= 10) &amp;&amp; (mouseY &lt;= 190));
}


void mouseClicked() {
  if ((mouseOverRect1()== false)&amp;&amp;(mouseOverRect2()== false)&amp;&amp;(mouseOverRect3()== false)) { // if mouse is outside the box
    if  (click == 0) { // and mouse is pressed
      fill (0);
      drawFigures ();
      myPort.write ('N');
    }
  }
}

void drawFigures() {

  rect(10, 10, 180, 180);
  rect(230, 10, 180, 180);
  rect( 450, 10, 180, 180);
}
</code></pre>

<p>Here is my code. thanks a lot!</p>
]]></description>
   </item>
   <item>
      <title>How to get LED to fade/ease in and out of color, rather than just "appear/disappear"?</title>
      <link>https://forum.processing.org/two/discussion/17086/how-to-get-led-to-fade-ease-in-and-out-of-color-rather-than-just-appear-disappear</link>
      <pubDate>Fri, 10 Jun 2016 12:50:40 +0000</pubDate>
      <dc:creator>Finz23</dc:creator>
      <guid isPermaLink="false">17086@/two/discussions</guid>
      <description><![CDATA[<p>Just needed help adjusting my processing code to make the LED fade in and out of color (or ease in/out), rather than just "appear/disappear". Here is a snippet of code for when the LED on pin9 activates in response to certain sound pitch range (f) being detected:</p>

<pre><code>  if(f &gt; 175  &amp;&amp; f &lt; 237) {
  background(255,0,0);
  arduino.analogWrite(9, 255);
  }
</code></pre>

<p>cheers!</p>
]]></description>
   </item>
   <item>
      <title>Arbitrary Audio Output on a Sample-by-Sample Basis</title>
      <link>https://forum.processing.org/two/discussion/14940/arbitrary-audio-output-on-a-sample-by-sample-basis</link>
      <pubDate>Tue, 16 Feb 2016 03:40:24 +0000</pubDate>
      <dc:creator>raritet</dc:creator>
      <guid isPermaLink="false">14940@/two/discussions</guid>
      <description><![CDATA[<p>I would like to control my computer's audio output to display images on an oscilloscope. My project would be almost trivial if there were some sort of function (or method, I guess) that treats the sound card digital to analog converter more like the way it's done on an Arduino. That is, if <code>analogWrite(LEFT_SPEAKER, outputValue);</code> or something similar were in a Processing library, everything would be perfect.</p>

<p>As far as I have been able to determine so far, it seems that I need to fill an array and play that array with one of the audio libraries. I would fill the array with whatever I calculate I need for the oscilloscope display and keep it filled as I go.</p>

<p>It seems like this shouldn't be an unusual task, but I haven't been able to find much information (or I have been looking in the wrong places). Has anyone out there come across something like this before and can point me to it?</p>

<p>Thanks for your help.</p>
]]></description>
   </item>
   <item>
      <title>How to change the volume of audio whilst playing</title>
      <link>https://forum.processing.org/two/discussion/14281/how-to-change-the-volume-of-audio-whilst-playing</link>
      <pubDate>Tue, 05 Jan 2016 22:41:58 +0000</pubDate>
      <dc:creator>_buchan</dc:creator>
      <guid isPermaLink="false">14281@/two/discussions</guid>
      <description><![CDATA[<p>So I have a code which goes through Processing into Arduino. It controls an LED and makes it pulsate like a heartbeat. What I want to achieve is the WhiteNoise increasing and decreasing in volume at the same time as the brightness of the LED gets brighter and dimmer.</p>

<p>Here is the code:</p>

<pre><code>import processing.serial.*;
import cc.arduino.*;
Arduino arduino;  
import processing.sound.*;
WhiteNoise noise;

int ledPin = 9;

void setup()
{
  //println(Arduino.list());
  arduino = new Arduino(this, "/dev/cu.usbmodem1411", 57600);
  arduino.pinMode(ledPin, Arduino.OUTPUT);

  size(640, 360);
  background(255);

  // Create the noise generator
  noise = new WhiteNoise(this);
  noise.play();
  noise.amp(0.5);
}      


void draw()

{  // fade in from min to max in increments of 5 points:
  for(int fadeValue = 0 ; fadeValue &lt;= 255; fadeValue +=5) { 
    // sets the value (range from 0 to 255):
    arduino.analogWrite(ledPin, fadeValue);         
    // wait for 20 milliseconds to see the dimming effect    
    delay(20);                            
  } 

  delay(1000);
  arduino.analogWrite(ledPin, 0);
  delay (80);
  arduino.analogWrite(ledPin, 255);  
  delay (100);
  arduino.analogWrite(ledPin, 0);
  delay (80);
  arduino.analogWrite(ledPin, 255);  

  // fade out from not-quite-max to min in increments of 5 points:
  for(int fadeValue = 200 ; fadeValue &gt;= 0; fadeValue -=random(2,20)) { 
    // sets the value (range from 0 to 200):
    arduino.analogWrite(ledPin, fadeValue);         
    // wait for 30 milliseconds to see the dimming effect    
    delay(30);                            
  } 
}
</code></pre>

<p>So at the moment, all that happens is that the LED performs as I want it to perform, but the WhiteNoise just plays solidly.</p>

<p>I think I could achieve the dip and rise in volume using the timing of the delays. However, so far, I have not been able to achieve volume changing at all.</p>

<p>Any help appreciated. Thank you.</p>
]]></description>
   </item>
   <item>
      <title>How to change the value of graph?</title>
      <link>https://forum.processing.org/two/discussion/12655/how-to-change-the-value-of-graph</link>
      <pubDate>Wed, 23 Sep 2015 14:48:48 +0000</pubDate>
      <dc:creator>ahmadtaufiq</dc:creator>
      <guid isPermaLink="false">12655@/two/discussions</guid>
      <description><![CDATA[<p>Hi there, Im using processing to control the birghtness of led with arduino. I already can control the brightness of led using mouse. But the problem is i want to change the value of graph so that the intersection of graph x and graph y is located in the middle. Below is the code that i used.</p>

<p>Processing Code</p>

<pre><code>//Processing Code
 import processing.serial.*;
Serial myPort;
void setup()
{
size(255, 255);
String portName = Serial.list()[0]; // This gets the first port on your computer.
myPort = new Serial(this, portName, 9600);
}

void draw() {
// Create a gradient for visualisation
for (int i = 0; i&lt;width; i++) {
for (int j = 0; j&lt;height; j++) {
color myCol = color(i,j,0);
set(i, j, myCol);

}
}
// Send an event trigger character to indicate the beginning of the communication
myPort.write('S');
// Send the value of the mouse's x-position
myPort.write(mouseX);
// Send the value of the mouse's y-position
myPort.write(mouseY);
}
</code></pre>

<p>Arduino code</p>

<pre><code>Arduino Code
int val, xVal, yVal;
void setup() {
Serial.begin(9600);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
}
void loop(){
// check if enough data has been sent from the computer:
if (Serial.available()&gt;2) {
// Read the first value. This indicates the beginning of the communication.
val = Serial.read();
// If the value is the event trigger character 'S'
if(val == 'S'){
// read the most recent byte, which is the x-value
xVal = Serial.read();
// Then read the y-value
yVal = Serial.read();
}
}
// And send those to the LEDS!
analogWrite(10, xVal);
analogWrite(11, yVal);
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>Arduino Uno and Processing</title>
      <link>https://forum.processing.org/two/discussion/10732/arduino-uno-and-processing</link>
      <pubDate>Sun, 10 May 2015 08:02:50 +0000</pubDate>
      <dc:creator>andoni</dc:creator>
      <guid isPermaLink="false">10732@/two/discussions</guid>
      <description><![CDATA[<p>I have a problem with analog Pin on Arduino Uno. I know this:</p>

<p>int ledPin1 = 1;    ---&gt;  LED connected to digital pin 1
 arduino.pinMode(ledPin1, Arduino.OUTPUT); 
 arduino.digitalWrite(ledPin1, Arduino.HIGH);
 arduino.digitalWrite(ledPin1, Arduino.LOW);</p>

<p>I suppose that the digital pin starts from 1 to 13,is it correct?</p>

<p>I want to use the analog pin(A1,A2,A3,A4,A5)for the command above, how can I do this?</p>

<p>thank you</p>
]]></description>
   </item>
   <item>
      <title>Analog pins with Processing and Arduino</title>
      <link>https://forum.processing.org/two/discussion/201/analog-pins-with-processing-and-arduino</link>
      <pubDate>Tue, 08 Oct 2013 19:42:36 +0000</pubDate>
      <dc:creator>iamdahm</dc:creator>
      <guid isPermaLink="false">201@/two/discussions</guid>
      <description><![CDATA[<p>Hey all.</p>

<p>I'm building an arcade machine with an Arduino Duemilanove ATmega328p and Processing. I want to use x4 rotary encoders and a joystick to control some features of my game. I have used all of my digital pins for 3 rotary encoders with built-in buttons (3 pins each), and the remainder for the joystick (4 pins). I have one more rotary encoder hooked up to the analog pins 3-5, but I am having trouble with interpreting numbers I return from the analogRead() method. I tried digitalRead() instead, but I am always left with a reading of 0 on both pins.  Does anybody have experience with rotary encoders and analog inputs?</p>
]]></description>
   </item>
   </channel>
</rss>