<?xml version="1.0" encoding="UTF-8"?>        <rss version="2.0"
             xmlns:atom="http://www.w3.org/2005/Atom"
             xmlns:dc="http://purl.org/dc/elements/1.1/"
             xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
             xmlns:admin="http://webns.net/mvcb/"
             xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
             xmlns:content="http://purl.org/rss/1.0/modules/content/">
        <channel>
            <title>
									Programming - eTechnophiles Forum				            </title>
            <link>https://forum.etechnophiles.com/arduino-programming/</link>
            <description>Hi,
Welcome to the eTechnophiles forum. 
Got a question like, \&#039;What resistor value to choose for your simple LED project\&#039; OR \&#039;Where is the resistor connected to the inbuilt LED in Arduino UNO\&#039;s schematic\&#039; - All will be answered here. 
Feel free to check out the topics below.</description>
            <language>en-US</language>
            <lastBuildDate>Thu, 16 Apr 2026 13:12:36 +0000</lastBuildDate>
            <generator>wpForo</generator>
            <ttl>60</ttl>
							                    <item>
                        <title>Can I use Analog pins as digital output pin?</title>
                        <link>https://forum.etechnophiles.com/arduino-programming/can-i-use-analog-pins-as-digital-output-pin/</link>
                        <pubDate>Thu, 03 Jul 2025 11:48:30 +0000</pubDate>
                        <description><![CDATA[Is it possible to use analog pins as digital output? If yes, how to do this? I mean what command should I type?]]></description>
                        <content:encoded><![CDATA[<p>Is it possible to use analog pins as digital output? If yes, how to do this? I mean what command should I type?</p>]]></content:encoded>
						                            <category domain="https://forum.etechnophiles.com/arduino-programming/">Programming</category>                        <dc:creator>Rahav</dc:creator>
                        <guid isPermaLink="true">https://forum.etechnophiles.com/arduino-programming/can-i-use-analog-pins-as-digital-output-pin/</guid>
                    </item>
				                    <item>
                        <title>Why does my HCR04 ultrasonic sensor give randome readings?</title>
                        <link>https://forum.etechnophiles.com/arduino-programming/why-does-my-hcr04-ultrasonic-sensor-give-randome-readings/</link>
                        <pubDate>Thu, 03 Apr 2025 07:33:26 +0000</pubDate>
                        <description><![CDATA[I&#039;m using an HC-SR04 ultrasonic sensor with my Arduino to measure distance, but I&#039;m getting inconsistent readings. Sometimes it works fine, but other times the values jump around randomly, e...]]></description>
                        <content:encoded><![CDATA[<p>I'm using an HC-SR04 ultrasonic sensor with my Arduino to measure distance, but I'm getting inconsistent readings. Sometimes it works fine, but other times the values jump around randomly, even when there's no object moving.</p>
<p><br />Here's my code:</p>
<pre contenteditable="false">const int trigPin = 7;
const int echoPin = 6;

void setup() {
    Serial.begin(9600);
    pinMode(trigPin, OUTPUT);
    pinMode(echoPin, INPUT);
}

void loop() {
    digitalWrite(trigPin, LOW);
    delayMicroseconds(2);
    digitalWrite(trigPin, HIGH);
    delayMicroseconds(10);
    digitalWrite(trigPin, LOW);

    long duration = pulseIn(echoPin, HIGH);
    int distance = duration * 0.034 / 2;

    Serial.println(distance);
    delay(500);
}
</pre>
<p><strong>The issues I am facing:</strong></p>
<ul>
<li>The sensor sometimes returns very high or very low values randomly.</li>
<li>The readings are unstable even when there’s a fixed object in front of it.</li>
<li>Sometimes I even get 0 cm, even though there’s no obstacle that close.</li>
</ul>
<p> </p>]]></content:encoded>
						                            <category domain="https://forum.etechnophiles.com/arduino-programming/">Programming</category>                        <dc:creator>Jignesh</dc:creator>
                        <guid isPermaLink="true">https://forum.etechnophiles.com/arduino-programming/why-does-my-hcr04-ultrasonic-sensor-give-randome-readings/</guid>
                    </item>
				                    <item>
                        <title>Why does my Servo motor Jitter instead of holding position?</title>
                        <link>https://forum.etechnophiles.com/arduino-programming/why-does-my-servo-motor-jitter-instead-of-holding-position/</link>
                        <pubDate>Tue, 11 Mar 2025 04:58:30 +0000</pubDate>
                        <description><![CDATA[I&#039;m trying to control a servo using my Arduino, but I&#039;m facing an issue where the servo jitters instead of holding its position. Even when I send a fixed angle using servo.write(), it moves ...]]></description>
                        <content:encoded><![CDATA[<p>I'm trying to control a servo using my Arduino, but I'm facing an issue where the servo jitters instead of holding its position. Even when I send a fixed angle using servo.write(), it moves slightly back and forth instead of staying still.</p>
<p><span style="font-weight: 400">Here's my basic setup:</span></p>
<ul>
<li style="font-weight: 400"><span style="font-weight: 400">Arduino Uno</span></li>
<li style="font-weight: 400"><span style="font-weight: 400">SG90 servo motor powered from the Arduino's 5V pin</span></li>
<li style="font-weight: 400"><span style="font-weight: 400">Signal wire connected to pin 9</span></li>
</ul>
<pre contenteditable="false">#include &lt;Servo.h&gt;

Servo myServo;

void setup() {
    myServo.attach(9);
    myServo.write(90); 
}

void loop() {
   
}
</pre>
<p>I've tried adding delay(1000); in the loop, but that didn't help. Do I need a separate power source for the servo, or is there another way to fix the jitter? Any advice would be greatly appreciated.</p>]]></content:encoded>
						                            <category domain="https://forum.etechnophiles.com/arduino-programming/">Programming</category>                        <dc:creator>hobart bess</dc:creator>
                        <guid isPermaLink="true">https://forum.etechnophiles.com/arduino-programming/why-does-my-servo-motor-jitter-instead-of-holding-position/</guid>
                    </item>
				                    <item>
                        <title>Program to toggle LED state with a single button?</title>
                        <link>https://forum.etechnophiles.com/arduino-programming/program-to-toggle-led-state-with-a-single-button/</link>
                        <pubDate>Fri, 28 Feb 2025 13:43:51 +0000</pubDate>
                        <description><![CDATA[I&#039;m working on an Arduino project where I need a single pushbutton to toggle between two states (like turning an LED ON and OFF) each time it&#039;s pressed. However, I&#039;m running into issues wher...]]></description>
                        <content:encoded><![CDATA[<p data-start="146" data-end="439">I'm working on an Arduino project where I need a single pushbutton to toggle between two states (like turning an LED ON and OFF) each time it's pressed. However, I'm running into issues where the button press either doesn't register correctly or rapidly toggles due to bouncing.</p>
<p data-start="146" data-end="439">I've tried using digitalRead() in a simple if condition, but I suspect I need to debounce the button properly. Should I use delay(), or is there a better approach using millis()?</p>
<p data-start="631" data-end="654">Here’s my basic code:</p>
<pre contenteditable="false">const int buttonPin = 2;
const int ledPin = 13;
bool ledState = false;

void setup() {
    pinMode(buttonPin, INPUT);
    pinMode(ledPin, OUTPUT);
}

void loop() {
    if (digitalRead(buttonPin) == HIGH) {
        ledState = !ledState;
        digitalWrite(ledPin, ledState);
        delay(200); // Debounce delay?
    }
}
</pre>
<p data-start="991" data-end="1109">Is there a more reliable way to debounce the button and avoid unwanted toggling? Any guidance would be appreciated!</p>]]></content:encoded>
						                            <category domain="https://forum.etechnophiles.com/arduino-programming/">Programming</category>                        <dc:creator>tricky_logic</dc:creator>
                        <guid isPermaLink="true">https://forum.etechnophiles.com/arduino-programming/program-to-toggle-led-state-with-a-single-button/</guid>
                    </item>
				                    <item>
                        <title>How does Arduino handle floating-point operations?</title>
                        <link>https://forum.etechnophiles.com/arduino-programming/how-does-arduino-handle-floating-point-operations/</link>
                        <pubDate>Tue, 07 Jan 2025 10:15:46 +0000</pubDate>
                        <description><![CDATA[I’m working on a project that requires floating-point calculations and would like to understand how Arduino handles them. How efficient are these operations, and what level of precision can ...]]></description>
                        <content:encoded><![CDATA[<p>I’m working on a project that requires floating-point calculations and would like to understand how Arduino handles them. How efficient are these operations, and what level of precision can I expect? Are there common issues like rounding errors or scenarios where floating-point math should be avoided, especially on boards like the Arduino Uno? Any insights would be greatly appreciated!</p>]]></content:encoded>
						                            <category domain="https://forum.etechnophiles.com/arduino-programming/">Programming</category>                        <dc:creator>electronicb_brain</dc:creator>
                        <guid isPermaLink="true">https://forum.etechnophiles.com/arduino-programming/how-does-arduino-handle-floating-point-operations/</guid>
                    </item>
				                    <item>
                        <title>Difference Between delay() and millis() in Arduino?</title>
                        <link>https://forum.etechnophiles.com/arduino-programming/difference-between-delay-and-millis-in-arduino/</link>
                        <pubDate>Wed, 06 Nov 2024 04:31:58 +0000</pubDate>
                        <description><![CDATA[Hey everyone,
I’m a bit confused about the delay() and millis() functions in Arduino. What’s the difference between them, and when should I use millis() instead of delay()?]]></description>
                        <content:encoded><![CDATA[<p>Hey everyone,</p>
<p>I’m a bit confused about the <code>delay()</code> and <code>millis()</code> functions in Arduino. What’s the difference between them, and when should I use <code>millis()</code> instead of <code>delay()</code>?</p>]]></content:encoded>
						                            <category domain="https://forum.etechnophiles.com/arduino-programming/">Programming</category>                        <dc:creator>CircuitSphere</dc:creator>
                        <guid isPermaLink="true">https://forum.etechnophiles.com/arduino-programming/difference-between-delay-and-millis-in-arduino/</guid>
                    </item>
				                    <item>
                        <title>Why Does analogWrite Use a 0-255 Range for PWM?</title>
                        <link>https://forum.etechnophiles.com/arduino-programming/why-does-analogwrite-use-a-0-255-range-for-pwm/</link>
                        <pubDate>Sat, 24 Aug 2024 04:49:28 +0000</pubDate>
                        <description><![CDATA[Hello everyone,
I&#039;m trying to understand why the analogWrite function in Arduino requires a value between 0 and 255 for PWM (Pulse Width Modulation). What does this range actually signify i...]]></description>
                        <content:encoded><![CDATA[<p>Hello everyone,</p>
<p>I'm trying to understand why the <code>analogWrite</code> function in Arduino requires a value between 0 and 255 for PWM (Pulse Width Modulation). What does this range actually signify in terms of how PWM works? Why specifically these values, and how does it relate to controlling the output?</p>
<p>thank you </p>]]></content:encoded>
						                            <category domain="https://forum.etechnophiles.com/arduino-programming/">Programming</category>                        <dc:creator>Paul</dc:creator>
                        <guid isPermaLink="true">https://forum.etechnophiles.com/arduino-programming/why-does-analogwrite-use-a-0-255-range-for-pwm/</guid>
                    </item>
				                    <item>
                        <title>analogWrite() Used on Digital Pins Instead of Analog Pins?</title>
                        <link>https://forum.etechnophiles.com/arduino-programming/analogwrite-used-on-digital-pins-instead-of-analog-pins/</link>
                        <pubDate>Tue, 04 Jun 2024 03:34:01 +0000</pubDate>
                        <description><![CDATA[I&#039;m new to Arduino and I&#039;m a bit confused about the analogWrite() function.
From what I understand, the analogWrite() command is used to generate a PWM (Pulse Width Modulation) signal, whic...]]></description>
                        <content:encoded><![CDATA[<p>I'm new to Arduino and I'm a bit confused about the <code>analogWrite()</code> function.</p>
<p>From what I understand, the <code>analogWrite()</code> command is used to generate a PWM (Pulse Width Modulation) signal, which can be used to control devices like LEDs and motors. However, I noticed that this function is used on digital pins that support PWM, rather than the analog pins.</p>
<ol>
<li><strong>Why is the <code>analogWrite()</code> command used on PWM digital pins and not on analog pins even though the command name suggest it work for analog?</strong></li>
</ol>
<p>It would be great if someone could explain the technical reasons behind this.</p>]]></content:encoded>
						                            <category domain="https://forum.etechnophiles.com/arduino-programming/">Programming</category>                        <dc:creator>Paul</dc:creator>
                        <guid isPermaLink="true">https://forum.etechnophiles.com/arduino-programming/analogwrite-used-on-digital-pins-instead-of-analog-pins/</guid>
                    </item>
				                    <item>
                        <title>Setting multiple pins as OUTPUT</title>
                        <link>https://forum.etechnophiles.com/arduino-programming/setting-multiple-pins-as-output/</link>
                        <pubDate>Thu, 02 May 2024 12:38:59 +0000</pubDate>
                        <description><![CDATA[Hi,
I am using 8 digital pins to control the 8 LEDs separately. Instead of writing &quot;pinMode(pin,OUTPUT)&quot; for every other pin, is there any short method?]]></description>
                        <content:encoded><![CDATA[<p>Hi,</p>
<p>I am using 8 digital pins to control the 8 LEDs separately. Instead of writing "pinMode(pin,OUTPUT)" for every other pin, is there any short method?</p>]]></content:encoded>
						                            <category domain="https://forum.etechnophiles.com/arduino-programming/">Programming</category>                        <dc:creator>Mehjabeen</dc:creator>
                        <guid isPermaLink="true">https://forum.etechnophiles.com/arduino-programming/setting-multiple-pins-as-output/</guid>
                    </item>
				                    <item>
                        <title>Why #define is used in Arduino programming?</title>
                        <link>https://forum.etechnophiles.com/arduino-programming/why-define-is-used-in-arduino-programming/</link>
                        <pubDate>Thu, 02 May 2024 12:14:26 +0000</pubDate>
                        <description><![CDATA[Hi everyone, I&#039;m new to Arduino programming and I&#039;m a bit confused with the use of #define. Here&#039;s an example code I came across where it is used:
#define SENSOR_PIN A0
#define LED_PIN 13...]]></description>
                        <content:encoded><![CDATA[<p><span>Hi everyone, I'm new to Arduino programming and I'm a bit confused with the use of #define. Here's an example code I came across where it is used:</span></p>
<pre contenteditable="false">#define SENSOR_PIN A0
#define LED_PIN 13

void setup() {
  pinMode(SENSOR_PIN, INPUT);
  pinMode(LED_PIN, OUTPUT);
}

void loop() {
  int sensorValue = analogRead(SENSOR_PIN);
  if (sensorValue &gt; 500) {
    digitalWrite(LED_PIN, HIGH);
  } else {
    digitalWrite(LED_PIN, LOW);
  }
}
</pre>
<p><span>Could someone explain to me what it does here and why to use it? Why not use this instead:</span></p>
<pre contenteditable="false">int SENSOR_PIN A0
int LED_PIN 13</pre>]]></content:encoded>
						                            <category domain="https://forum.etechnophiles.com/arduino-programming/">Programming</category>                        <dc:creator>Tech Geek</dc:creator>
                        <guid isPermaLink="true">https://forum.etechnophiles.com/arduino-programming/why-define-is-used-in-arduino-programming/</guid>
                    </item>
							        </channel>
        </rss>
		