التحكم في محرك بواسطة اضغط الزر باستخدام أردوينو | DC MOTOR CONTROL PUSH BUTTON
- المكونات الاساسية :
- Arduino UNO R3
- DC Motor
- Push button
- Mini Breadboard
- Jumper wires
---------------------------------------------------------------------------------------
- مخطط الرسم البياني :
// Project : DC motor Control Push Button With Arduino
// By : DIY Channel
// My Youtube Channel : https://www.youtube.com/c/DIYChannel2019
int pinmotor = 10;
int pinSwitch = 2;
boolean oldSwitchState = LOW;
boolean newSwitchState = LOW;
boolean motorstatus = LOW;
void setup()
{
pinMode(pinmotor, OUTPUT);
digitalWrite(pinmotor, LOW);
pinMode(pinSwitch, INPUT);
}
void loop()
{
newSwitchState = digitalRead(pinSwitch);
if ( newSwitchState != oldSwitchState )
{
// has the button switch been closed?
if ( newSwitchState == HIGH )
{
if ( motorstatus == LOW ) {
digitalWrite(pinmotor, HIGH);
motorstatus = HIGH;
}
else {
digitalWrite(pinmotor, LOW);
motorstatus = LOW;
}
}
oldSwitchState = newSwitchState;
}
}
-------------------------------------------------------------------------
electronic,tutorial,training,video,robojax,arduino,code,download,l298n,dc,motor,contorl,module,ahmad,shamshiri,canada,canadian,ajax,push,buttons,button,clockwise,counterclockwise,speed,how to,arduino project,dc motor,tinkercad,arduino for beginners,tinkercad dc motor,simple arduino for beginners,cool arduino projects,cool arduino projects in easy steps,best arduino projects,difficult arduino projects,simple way to make dc motor display,top 10 arduino projects,basic dc motor display,coding
No comments:
Post a Comment