Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
Ad icon
Sell your Land, House on idamata.lk for FREE
sajith.xp.pk
Updated:
Thursday at 9:03 AM
Handmade Character Soft Toys
anil1961
Updated:
Tuesday at 2:11 PM
Bodim.lk out now !
Manoj Suranga Bandara
Updated:
Sunday at 3:05 AM
Power Lifting Lever Belt
SkullVamp
Updated:
Jun 13, 2026
Ad icon
port.lk Domain for sale
Lankan-Tech
Updated:
Jun 13, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
ElaKiri Help
Arduino help
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="apikaluda?" data-source="post: 24122100" data-attributes="member: 470863"><p>On karapu gaman mehema yanawa</p><p>Code:</p><p>Push button state Forward LS State Reverse LS State</p><p>1 1 1</p><p>0 1 1</p><p>0 1 1</p><p>0 1 1</p><p>0 1 1</p><p>0 1 1</p><p>1 1 1</p><p>1 1 1</p><p>1 1 1</p><p>1 1 1</p><p>0 1 1</p><p>0 1 1</p><p>0 1 1</p><p>0 1 1</p><p>0 1 1</p><p>0 1 1</p><p>1 1 1</p><p>1 1 1</p><p>1 1 1</p><p>1 1 1</p><p>1 1 1</p><p></p><p></p><p><span style="font-size: 15px"><span style="color: blue">Machan push button eke awulak thiyenawa. Mata penne button eka open (off mode - not pushed) ekedi FLOAT wenawa....e kiyanne button eka 0-1 value athare float wenawa. ethakota board eken e value eka round-off, e kiyanne agaya 0 or 1 kiyana aasanna agayata watayanawa. ekai push button value eka 0 - 1 athare maaru wenne. </span></span></p><p><span style="font-size: 15px"><span style="color: blue"></span></span></p><p><span style="font-size: 15px"><span style="color: blue">Machan ekata lesima de board eke internal pull-up resistor eka ON karana eka, eka karanne pinMode(buttonPin, <strong>INPUT_PULLUP</strong>); kiyala code eka wenas kalama hari.</span></span></p><p><span style="font-size: 15px"><span style="color: blue">Code eka wenas kalama mehemai:</span></span></p><p></p><p></p><p><span style="font-size: 12px">// Code is to check the correct operating conditions of the three buttons</span></p><p><span style="font-size: 12px">// ******REMOVE ALL CONNECTION TO STEPPER AND CONNECT ONLY THE PUSH BTN, 2 LIMIT SWITCHES*******</span></p><p><span style="font-size: 12px">//</span></p><p><span style="font-size: 12px">// connections are to be done as follows:</span></p><p><span style="font-size: 12px">// PUSH BUTTON > PIN 6</span></p><p><span style="font-size: 12px">// FORWARD LS > PIN 2</span></p><p><span style="font-size: 12px">// REVERSE LS > PIN 7</span></p><p><span style="font-size: 12px">//</span></p><p><span style="font-size: 12px">// THEN:</span></p><p><span style="font-size: 12px">// check for the following conditions using Serial Monitor</span></p><p><span style="font-size: 12px">//1) push only push button and check the states of all three buttons </span></p><p><span style="font-size: 12px">//2) push only Forward LS and check the states of all three buttons</span></p><p><span style="font-size: 12px">//3) push only Reverse LS and check the states of all three buttons </span></p><p><span style="font-size: 12px">//4) push (push button + Forward LS) and check the states of all three buttons</span></p><p><span style="font-size: 12px">//5) push (push button + Reverse LS) and check the states of all three buttons</span></p><p><span style="font-size: 12px">//6) push (Forward LS + Reverse LS) and check the states of all three buttons</span></p><p><span style="font-size: 12px">//7) push (push button + Forward LS + Reverse LS) and check the states of all three buttons</span></p><p><span style="font-size: 12px"></span></p><p><span style="font-size: 12px">//==========================================================================================</span></p><p><span style="font-size: 12px">const int ForwardLimitSwitchPin = 2; //forward LS pin</span></p><p><span style="font-size: 12px">const int ReverseLimitSwitchPin = 7; // reverse LS pin</span></p><p><span style="font-size: 12px">const int buttonPin = 6; // the number of the pushbutton pin (choose the correct pin here)</span></p><p><span style="font-size: 12px"></span></p><p><span style="font-size: 12px"></span></p><p><span style="font-size: 12px">void setup() {</span></p><p><span style="font-size: 12px">pinMode(ForwardLimitSwitchPin, INPUT_PULLUP); //declare two LS as inputs</span></p><p><span style="font-size: 12px">pinMode(ReverseLimitSwitchPin, INPUT_PULLUP); </span></p><p><span style="font-size: 12px">pinMode(buttonPin, INPUT_PULLUP); //declare push button signal as an input</span></p><p><span style="font-size: 12px">Serial.begin(9600); //Serial Monitoring ON</span></p><p><span style="font-size: 12px">Serial.println("Push button state\t\tForward LS State\t\tReverse LS State");</span></p><p><span style="font-size: 12px">}</span></p><p><span style="font-size: 12px"></span></p><p><span style="font-size: 12px">void loop() { </span></p><p><span style="font-size: 12px">Serial.print(digitalRead(buttonPin);</span></p><p><span style="font-size: 12px">Serial.print("\t\t\t\t\t\t\t\t");</span></p><p><span style="font-size: 12px">Serial.print(digitalRead(ForwardLimitSwitchPin));</span></p><p><span style="font-size: 12px">Serial.print("\t\t\t\t\t\t\t\t"); </span></p><p><span style="font-size: 12px">Serial.println(digitalRead(ReverseLimitSwitchPin)); </span></p><p><span style="font-size: 12px">} </span></p><p><span style="font-size: 12px">//==========================================================================================</span></p><p><span style="font-size: 12px"></span></p><p></p><p></p><p><span style="font-size: 15px"><span style="color: blue">Machan den wede balanna....hariyata states enna oni...enawanam ape code eka eeta passe hadaganna puluwan lesiyenma</span></span></p></blockquote><p></p>
[QUOTE="apikaluda?, post: 24122100, member: 470863"] On karapu gaman mehema yanawa Code: Push button state Forward LS State Reverse LS State 1 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [SIZE=4][COLOR=blue]Machan push button eke awulak thiyenawa. Mata penne button eka open (off mode - not pushed) ekedi FLOAT wenawa....e kiyanne button eka 0-1 value athare float wenawa. ethakota board eken e value eka round-off, e kiyanne agaya 0 or 1 kiyana aasanna agayata watayanawa. ekai push button value eka 0 - 1 athare maaru wenne. [/COLOR][/SIZE] [SIZE=4][COLOR=blue]Machan ekata lesima de board eke internal pull-up resistor eka ON karana eka, eka karanne pinMode(buttonPin, [B]INPUT_PULLUP[/B]); kiyala code eka wenas kalama hari.[/COLOR][/SIZE] [SIZE=4][COLOR=blue]Code eka wenas kalama mehemai:[/COLOR][/SIZE] [SIZE=3]// Code is to check the correct operating conditions of the three buttons // ******REMOVE ALL CONNECTION TO STEPPER AND CONNECT ONLY THE PUSH BTN, 2 LIMIT SWITCHES******* // // connections are to be done as follows: // PUSH BUTTON > PIN 6 // FORWARD LS > PIN 2 // REVERSE LS > PIN 7 // // THEN: // check for the following conditions using Serial Monitor //1) push only push button and check the states of all three buttons //2) push only Forward LS and check the states of all three buttons //3) push only Reverse LS and check the states of all three buttons //4) push (push button + Forward LS) and check the states of all three buttons //5) push (push button + Reverse LS) and check the states of all three buttons //6) push (Forward LS + Reverse LS) and check the states of all three buttons //7) push (push button + Forward LS + Reverse LS) and check the states of all three buttons //========================================================================================== const int ForwardLimitSwitchPin = 2; //forward LS pin const int ReverseLimitSwitchPin = 7; // reverse LS pin const int buttonPin = 6; // the number of the pushbutton pin (choose the correct pin here) void setup() { pinMode(ForwardLimitSwitchPin, INPUT_PULLUP); //declare two LS as inputs pinMode(ReverseLimitSwitchPin, INPUT_PULLUP); pinMode(buttonPin, INPUT_PULLUP); //declare push button signal as an input Serial.begin(9600); //Serial Monitoring ON Serial.println("Push button state\t\tForward LS State\t\tReverse LS State"); } void loop() { Serial.print(digitalRead(buttonPin); Serial.print("\t\t\t\t\t\t\t\t"); Serial.print(digitalRead(ForwardLimitSwitchPin)); Serial.print("\t\t\t\t\t\t\t\t"); Serial.println(digitalRead(ReverseLimitSwitchPin)); } //========================================================================================== [/SIZE] [SIZE=4][COLOR=blue]Machan den wede balanna....hariyata states enna oni...enawanam ape code eka eeta passe hadaganna puluwan lesiyenma[/COLOR][/SIZE] [/QUOTE]
Insert quotes…
Verification
Winadiyakata thappara keeyak tibeda?
Post reply
Top
Bottom