<?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>
									Remote Light Switch by Wireless from Nano - Arduino				            </title>
            <link>https://forum.dronebotworkshop.com/arduino/remote-light-switch-by-wireless-from-nano/</link>
            <description>Discussion board for Robotics, Arduino, Raspberry Pi and other DIY electronics and modules. Join us today!</description>
            <language>en-US</language>
            <lastBuildDate>Mon, 10 Aug 2026 17:07:22 +0000</lastBuildDate>
            <generator>wpForo</generator>
            <ttl>60</ttl>
							                    <item>
                        <title>Remote Light Switch by Wireless from Nano</title>
                        <link>https://forum.dronebotworkshop.com/arduino/remote-light-switch-by-wireless-from-nano/#post-14707</link>
                        <pubDate>Sun, 10 Jan 2021 10:25:56 +0000</pubDate>
                        <description><![CDATA[Hi
 
I am attempting to set up 2 x Arduino Nano’s for remote controlled 12vdc spotlight use.
 
Components:
 
2 x Arduino nano
2 x nRF24L01 wireless modules
1 x L298N Dual H Bridge mo...]]></description>
                        <content:encoded><![CDATA[<p style="margin-bottom: 0cm;line-height: 100%">Hi</p>
<p style="margin-bottom: 0cm;line-height: 100%"> </p>
<p style="margin-bottom: 0cm;line-height: 100%">I am attempting to set up 2 x Arduino Nano’s for remote controlled 12vdc spotlight use.</p>
<p style="margin-bottom: 0cm;line-height: 100%"> </p>
<p style="margin-bottom: 0cm;line-height: 100%">Components:</p>
<p style="margin-bottom: 0cm;line-height: 100%"> </p>
<p style="margin-bottom: 0cm;line-height: 100%">2 x Arduino nano</p>
<p style="margin-bottom: 0cm;line-height: 100%">2 x nRF24L01 wireless modules</p>
<p style="margin-bottom: 0cm;line-height: 100%">1 x L298N Dual H Bridge module</p>
<p style="margin-bottom: 0cm;line-height: 100%">1 x Joy Stick (same as project type)</p>
<p style="margin-bottom: 0cm;line-height: 100%">1 x 12vdc 40RPM reversible motor (rotator)</p>
<p style="margin-bottom: 0cm;line-height: 100%">1 x 12vdc 2rpm reversible motor (up/down)</p>
<p style="margin-bottom: 0cm;line-height: 100%">2 x sets 2:1 ratio gear (20:40)</p>
<p style="margin-bottom: 0cm;line-height: 100%"> </p>
<p style="margin-bottom: 0cm;line-height: 100%">1 x 40amp 12v 5pole relay</p>
<p style="margin-bottom: 0cm;line-height: 100%"> </p>
<p style="margin-bottom: 0cm;line-height: 100%">Power : 12 volt dc – standard motor vehicle current.</p>
<p style="margin-bottom: 0cm;line-height: 100%">Relevant Buck up/down to suit module power requirements and to smooth out flow.</p>
<p style="margin-bottom: 0cm;line-height: 100%"> </p>
<p style="margin-bottom: 0cm;line-height: 100%">The idea for this came from the DroneBot Workshop YouTube video “Wireless Joystick for Arduino Robot car with nRF24L01”.</p>
<p style="margin-bottom: 0cm;line-height: 100%">}</p>
<p style="margin-bottom: 0cm;line-height: 100%">I would like to use the SW (Switch) on the joy stick to remote activate the spotlight. This requires 2 x digital pins:</p>
<p style="margin-bottom: 0cm;line-height: 100%"> </p>
<p style="margin-bottom: 0cm;line-height: 100%">( As per Paul McWhorters Tutorials 27 &amp; 28)- I adapted his tutes and have the Joy Stick switch operating.</p>
<p style="margin-bottom: 0cm;line-height: 100%">int LEDState=0;</p>
<p style="margin-bottom: 0cm;line-height: 100%">int LEDPin =8;</p>
<p style="margin-bottom: 0cm;line-height: 100%">i<span style="background: transparent">nt buttonPin=1</span><span style="background: transparent">2</span><span style="background: transparent">; </span></p>
<p style="margin-bottom: 0cm;line-height: 100%">int buttonNew;</p>
<p style="margin-bottom: 0cm;line-height: 100%">int buttonOld=1;</p>
<p style="margin-bottom: 0cm;line-height: 100%">int dt=100;</p>
<p style="margin-bottom: 0cm;line-height: 100%"> </p>
<p style="margin-bottom: 0cm;line-height: 100%">void setup() {</p>
<p style="margin-bottom: 0cm;line-height: 100%">// put your setup code here, to run once:</p>
<p style="margin-bottom: 0cm;line-height: 100%">Serial.begin(9600);</p>
<p style="margin-bottom: 0cm;line-height: 100%">pinMode (LEDPin, OUTPUT);</p>
<p style="margin-bottom: 0cm;line-height: 100%">pinMode (buttonPin, INPUT);</p>
<p style="margin-bottom: 0cm;line-height: 100%">}</p>
<p style="margin-bottom: 0cm;line-height: 100%">void loop() {</p>
<p style="margin-bottom: 0cm;line-height: 100%">// put your main code here, to run repeatedly:</p>
<p style="margin-bottom: 0cm;line-height: 100%">buttonNew=digitalRead(buttonPin);</p>
<p style="margin-bottom: 0cm;line-height: 100%">if(buttonOld==0 &amp;&amp; buttonNew==1){</p>
<p style="margin-bottom: 0cm;line-height: 100%">if(LEDState==0){</p>
<p style="margin-bottom: 0cm;line-height: 100%">digitalWrite(LEDPin,HIGH);</p>
<p style="margin-bottom: 0cm;line-height: 100%">LEDState=1;</p>
<p style="margin-bottom: 0cm;line-height: 100%"> </p>
<p style="margin-bottom: 0cm;line-height: 100%">}</p>
<p style="margin-bottom: 0cm;line-height: 100%">else{</p>
<p style="margin-bottom: 0cm;line-height: 100%">digitalWrite(LEDPin, LOW);</p>
<p style="margin-bottom: 0cm;line-height: 100%">LEDState=0;</p>
<p style="margin-bottom: 0cm;line-height: 100%">}</p>
<p style="margin-bottom: 0cm;line-height: 100%">}</p>
<p style="margin-bottom: 0cm;line-height: 100%">buttonOld=buttonNew;</p>
<p style="margin-bottom: 0cm;line-height: 100%">delay(dt);</p>
<p style="margin-bottom: 0cm;line-height: 100%"> </p>
<p style="margin-bottom: 0cm;line-height: 100%">}</p>
<p style="margin-bottom: 0cm;line-height: 100%"> </p>
<p style="margin-bottom: 0cm;line-height: 100%">However:</p>
<p style="margin-bottom: 0cm;line-height: 100%"> </p>
<p style="margin-bottom: 0cm;line-height: 100%">The DroneBot video etc is based on the Uno not the Nano.</p>
<p style="margin-bottom: 0cm;line-height: 100%"><span style="background: #ffff00">On the client end of the wireless transmission I have</span></p>
<p style="margin-bottom: 0cm;line-height: 100%">1 x Nano – with effectively 12 digital pins.</p>
<p style="margin-bottom: 0cm;line-height: 100%">1 x nRF24L01 takes up 5 pins</p>
<p style="margin-bottom: 0cm;line-height: 100%">1 x L298N takes up 6 pins.</p>
<p style="margin-bottom: 0cm;line-height: 100%"> </p>
<p style="margin-bottom: 0cm;line-height: 100%">I have 1 x Digital pin left{</p>
<p style="margin-bottom: 0cm;line-height: 100%"> </p>
<table width="363" cellspacing="0" cellpadding="2">
<tbody>
<tr valign="bottom">
<td style="border: none;padding: 0cm" width="111" height="16">
<p align="left">Pin Nr nano</p>
</td>
<td style="border: none;padding: 0cm" width="76">
<p align="left">Nrf24</p>
</td>
<td style="border: none;padding: 0cm" width="80">
<p align="left">L298N</p>
</td>
<td style="border: none;padding: 0cm" width="80">
<p align="left">JS Signal</p>
</td>
</tr>
<tr valign="bottom">
<td style="border: none;padding: 0cm" width="111" height="16">
<p align="center">1</p>
</td>
<td style="border: none;padding: 0cm" width="76">
<p align="left"> </p>
</td>
<td style="border: none;padding: 0cm" width="80">
<p align="left"> </p>
</td>
<td style="border: none;padding: 0cm" width="80">
<p align="left"> </p>
</td>
</tr>
<tr valign="bottom">
<td style="border: none;padding: 0cm" width="111" height="16">
<p align="center">2</p>
</td>
<td style="border: none;padding: 0cm" width="76">
<p align="left"> </p>
</td>
<td style="border: none;padding: 0cm" width="80">
<p align="left"> </p>
</td>
<td style="border: none;padding: 0cm" width="80">
<p align="left"> </p>
</td>
</tr>
<tr valign="bottom">
<td style="border: none;padding: 0cm" width="111" height="16">
<p align="center">Reset</p>
</td>
<td style="border: none;padding: 0cm" width="76">
<p align="left"> </p>
</td>
<td style="border: none;padding: 0cm" width="80">
<p align="left"> </p>
</td>
<td style="border: none;padding: 0cm" width="80">
<p align="left"> </p>
</td>
</tr>
<tr>
<td style="border: none;padding: 0cm" width="111" height="16">
<p align="center">GND</p>
</td>
<td style="border: none;padding: 0cm" width="76">
<p align="center"> </p>
</td>
<td style="border: none;padding: 0cm" valign="bottom" width="80">
<p align="left"> </p>
</td>
<td style="border: none;padding: 0cm" width="80">
<p align="center"> </p>
</td>
</tr>
<tr>
<td style="border: none;padding: 0cm" valign="bottom" width="111" height="16">
<p align="center">5</p>
</td>
<td style="border: none;padding: 0cm" valign="bottom" width="76">
<p align="left"> </p>
</td>
<td style="border: none;padding: 0cm" width="80">
<p align="center"> </p>
</td>
<td style="border: none;padding: 0cm" width="80">
<p align="center"><span style="background: #ffff00">SW?</span></p>
</td>
</tr>
<tr>
<td style="border: none;padding: 0cm" valign="bottom" width="111" height="16">
<p align="center">6~</p>
</td>
<td style="border: none;padding: 0cm" valign="bottom" width="76">
<p align="left"> </p>
</td>
<td style="border: none;padding: 0cm" width="80">
<p align="center">IN4</p>
</td>
<td style="border: none;padding: 0cm" width="80">
<p align="center"> </p>
</td>
</tr>
<tr>
<td style="border: none;padding: 0cm" valign="bottom" width="111" height="16">
<p align="center">7</p>
</td>
<td style="border: none;padding: 0cm" width="76">
<p align="left"> </p>
</td>
<td style="border: none;padding: 0cm" width="80">
<p align="center">IN3</p>
</td>
<td style="border: none;padding: 0cm" width="80">
<p align="center"> </p>
</td>
</tr>
<tr>
<td style="border: none;padding: 0cm" valign="bottom" width="111" height="16">
<p align="center">8~</p>
</td>
<td style="border: none;padding: 0cm" valign="bottom" width="76">
<p align="left"> </p>
</td>
<td style="border: none;padding: 0cm" width="80">
<p align="center">ENB</p>
</td>
<td style="border: none;padding: 0cm" valign="bottom" width="80">
<p align="left"> </p>
</td>
</tr>
<tr>
<td style="border: none;padding: 0cm" valign="bottom" width="111" height="16">
<p align="center">9~</p>
</td>
<td style="border: none;padding: 0cm" valign="bottom" width="76">
<p align="left"> </p>
</td>
<td style="border: none;padding: 0cm" width="80">
<p align="center">ENA</p>
</td>
<td style="border: none;padding: 0cm" width="80">
<p align="center"> </p>
</td>
</tr>
<tr>
<td style="border: none;padding: 0cm" valign="bottom" width="111" height="16">
<p align="center">10</p>
</td>
<td style="border: none;padding: 0cm" valign="bottom" width="76">
<p align="left"> </p>
</td>
<td style="border: none;padding: 0cm" width="80">
<p align="center">IN2</p>
</td>
<td style="border: none;padding: 0cm" valign="bottom" width="80">
<p align="left"> </p>
</td>
</tr>
<tr>
<td style="border: none;padding: 0cm" valign="bottom" width="111" height="16">
<p align="center">11</p>
</td>
<td style="border: none;padding: 0cm" width="76">
<p align="left"> </p>
</td>
<td style="border: none;padding: 0cm" width="80">
<p align="center">IN1</p>
</td>
<td style="border: none;padding: 0cm" valign="bottom" width="80">
<p align="left"> </p>
</td>
</tr>
<tr>
<td style="border: none;padding: 0cm" valign="bottom" width="111" height="16">
<p align="center">12~</p>
</td>
<td style="border: none;padding: 0cm" width="76">
<p align="left">4 - CSN</p>
</td>
<td style="border: none;padding: 0cm" width="80">
<p align="center"> </p>
</td>
<td style="border: none;padding: 0cm" valign="bottom" width="80">
<p align="left"> </p>
</td>
</tr>
<tr>
<td style="border: none;padding: 0cm" valign="bottom" width="111" height="16">
<p align="center">13~</p>
</td>
<td style="border: none;padding: 0cm" width="76">
<p align="left">3 - CE</p>
</td>
<td style="border: none;padding: 0cm" valign="bottom" width="80">
<p align="left"> </p>
</td>
<td style="border: none;padding: 0cm" valign="bottom" width="80">
<p align="left"> </p>
</td>
</tr>
<tr>
<td style="border: none;padding: 0cm" valign="bottom" width="111" height="18">
<p align="center">14~</p>
</td>
<td style="border: none;padding: 0cm" width="76">
<p align="left">6 - MOSI</p>
</td>
<td style="border: none;padding: 0cm" valign="bottom" width="80">
<p align="left"> </p>
</td>
<td style="border: none;padding: 0cm" valign="bottom" width="80">
<p align="left"> </p>
</td>
</tr>
<tr>
<td style="border: none;padding: 0cm" valign="bottom" width="111" height="14">
<p align="center">15</p>
</td>
<td style="border: none;padding: 0cm" width="76">
<p align="left">7 - MISO</p>
</td>
<td style="border: none;padding: 0cm" valign="bottom" width="80">
<p align="left"> </p>
</td>
<td style="border: none;padding: 0cm" valign="bottom" width="80">
<p align="left"> </p>
</td>
</tr>
<tr>
<td style="border: none;padding: 0cm" valign="bottom" width="111" height="16">
<p align="center">16</p>
</td>
<td style="border: none;padding: 0cm" width="76">
<p align="left">5 - SCK</p>
</td>
<td style="border: none;padding: 0cm" valign="bottom" width="80">
<p align="left"> </p>
</td>
<td style="border: none;padding: 0cm" valign="bottom" width="80">
<p align="left"> </p>
</td>
</tr>
<tr>
<td style="border: none;padding: 0cm" valign="bottom" width="111" height="16">
<p align="center">A0</p>
</td>
<td style="border: none;padding: 0cm" valign="bottom" width="76">
<p align="left"> </p>
</td>
<td style="border: none;padding: 0cm" valign="bottom" width="80">
<p align="left"> </p>
</td>
<td style="border: none;padding: 0cm" width="80">
<p align="center"> </p>
</td>
</tr>
<tr valign="bottom">
<td style="border: none;padding: 0cm" width="111" height="16">
<p align="center">A1</p>
</td>
<td style="border: none;padding: 0cm" width="76">
<p align="left"> </p>
</td>
<td style="border: none;padding: 0cm" width="80">
<p align="left"> </p>
</td>
<td style="border: none;padding: 0cm" width="80">
<p align="center"> </p>
</td>
</tr>
</tbody>
</table>
<p style="margin-bottom: 0cm;line-height: 100%"> </p>
<p style="margin-bottom: 0cm;line-height: 100%"> </p>
<p style="margin-bottom: 0cm;line-height: 100%">Question 1.</p>
<p style="margin-bottom: 0cm;line-height: 100%"> </p>
<p style="margin-bottom: 0cm;line-height: 100%">On the client side will the nano require 2 pins as this will be an output to the relay.</p>
<p style="margin-bottom: 0cm;line-height: 100%"> </p>
<p style="margin-bottom: 0cm;line-height: 100%">If 2 pins required then:-</p>
<p style="margin-bottom: 0cm;line-height: 100%"> </p>
<p style="margin-bottom: 0cm;line-height: 100%">Question 2.</p>
<p style="margin-bottom: 0cm;line-height: 100%"> </p>
<p style="margin-bottom: 0cm;line-height: 100%">Can I use Pins 1 or 2? - I have attempted to use them with no effect</p>
<p style="margin-bottom: 0cm;line-height: 100%"> </p>
<p style="margin-bottom: 0cm;line-height: 100%">Can I use a Analog pin? I have attempted to use them with no effect.</p>
<p style="margin-bottom: 0cm;line-height: 100%"> </p>
<p style="margin-bottom: 0cm;line-height: 100%">Any help on these questions would be appreciated.</p>]]></content:encoded>
						                            <category domain="https://forum.dronebotworkshop.com/arduino/">Arduino</category>                        <dc:creator>Greg</dc:creator>
                        <guid isPermaLink="true">https://forum.dronebotworkshop.com/arduino/remote-light-switch-by-wireless-from-nano/#post-14707</guid>
                    </item>
							        </channel>
        </rss>
		