How to use vooruit method in SeleniumBase

Best Python code snippet using SeleniumBase

Mick Program V2.py

Source: Mick Program V2.py Github

copy

Full Screen

1'''IMPORTEREN VAN ALLE LIBRARY'S'''2import RPi.GPIO as GPIO3import time4import random5#---------------------------------------------------------6'''PINMODES AANGEVEN'''7GPIO.setmode(GPIO.BCM)8GPIO.setwarnings(False)9#---------------------------------------------------------10'''OP WELKE PINS ZITTEN DE MOTOREN'''11pinLinksVooruit = 1012pinLinksAchteruit = 913pinRechtsVooruit = 814pinRechtsAchteruit = 715#---------------------------------------------------------16'''OP WELKE PINS ZITTEN DE 'OGEN' '''17pinStuurSignaal = 1718pinOntvangSignaal = 1819#---------------------------------------------------------20'''OP WELKE PINS ZITTEN DE LICHTSENSOREN'''21pinLichtSensor = 2522#---------------------------------------------------------23'''OP WELKE PINS ZITTEN DE LEDJES'''24pinLED1 = 2225pinLED2 = 2326#----------------------------------------------------------27'''FREQUENTIE VAN DE WIELEN, HOEVAAK AAN/​UIT PER SECONDE'''28frequentie = 1029#---------------------------------------------------------30'''PROCENTEN DAT DE WIELEN AAN MOETEN STAAN'''31rondjesLinks = 5032rondjesRechts = 3033#---------------------------------------------------------34'''VARIABELE VOOR HET STOPPEN VAN DE AUTO'''35stop = 036#---------------------------------------------------------37'''de variablen omtrent motor-snelheid'''38snelheidWielLinks = 10039snelheidWielRechts = 8340snelheidMaal = .3741#---------------------------------------------------------42'''ZIJN DE PINNEN IN/​OUT-PUT'''43GPIO.setup(pinLinksVooruit, GPIO.OUT)44GPIO.setup(pinLinksAchteruit, GPIO.OUT)45GPIO.setup(pinRechtsVooruit, GPIO.OUT)46GPIO.setup(pinRechtsAchteruit, GPIO.OUT)47GPIO.setup(pinStuurSignaal, GPIO.OUT)48GPIO.setup(pinOntvangSignaal, GPIO.IN)49GPIO.setup(pinLichtSensor, GPIO.IN)50GPIO.setup(pinLED1, GPIO.OUT)51GPIO.setup(pinLED2, GPIO.OUT)52#---------------------------------------------------------53'''VARIABELEN VOOR AFSTANDSMETING'''54hoeDichtBij = 35.055draaiTijd = 0.7556#---------------------------------------------------------57'''ZET PWM OP 'FREQUENTIE' '''58pwmMotorLinksVooruit = GPIO.PWM(pinLinksVooruit, frequentie)59pwmMotorLinksAchteruit = GPIO.PWM(pinLinksAchteruit, frequentie)60pwmMotorRechtsVooruit = GPIO.PWM(pinRechtsVooruit, frequentie)61pwmMotorRechtsAchteruit = GPIO.PWM(pinRechtsAchteruit, frequentie)62#---------------------------------------------------------63'''ZET ALLES UIT'''64pwmMotorLinksVooruit.start(stop)65pwmMotorLinksAchteruit.start(stop)66pwmMotorRechtsVooruit.start(stop)67pwmMotorRechtsAchteruit.start(stop)68#---------------------------------------------------------69'''FUNCTIE VOOR ALLE MOTORS UIT'''70def motorsUit():71 pwmMotorLinksVooruit.ChangeDutyCycle(stop)72 pwmMotorLinksAchteruit.ChangeDutyCycle(stop)73 pwmMotorRechtsVooruit.ChangeDutyCycle(stop)74 pwmMotorRechtsAchteruit.ChangeDutyCycle(stop)75#---------------------------------------------------------76'''FUNCTIE VOOR VOORUIT'''77def rijVooruit():78 pwmMotorLinksVooruit.ChangeDutyCycle(snelheidWielLinks * snelheidMaal)79 pwmMotorLinksAchteruit.ChangeDutyCycle(0)80 pwmMotorRechtsVooruit.ChangeDutyCycle(snelheidWielRechts * snelheidMaal)81 pwmMotorLinksAchteruit.ChangeDutyCycle(0)82#---------------------------------------------------------83'''FUNCTIE VOOR ACHTERUIT'''84def rijAchteruit():85 pwmMotorLinksVooruit.ChangeDutyCycle(0)86 pwmMotorLinksAchteruit.ChangeDutyCycle(snelheidWielLinks * snelheidMaal)87 pwmMotorRechtsVooruit.ChangeDutyCycle(0)88 pwmMotorRechtsAchteruit.ChangeDutyCycle(snelheidWielRechts * snelheidMaal)89#---------------------------------------------------------90'''FUNCTIE VOOR LINKS'''91def Links():92 pwmMotorLinksVooruit.ChangeDutyCycle(snelheidWielLinks * snelheidMaal)93 pwmMotorLinksAchteruit.ChangeDutyCycle(0)94 pwmMotorRechtsVooruit.ChangeDutyCycle(0)95 pwmMotorRechtsAchteruit.ChangeDutyCycle(snelheidWielRechts * snelheidMaal)96#---------------------------------------------------------97'''FUNCTIE VOOR RECHTS'''98def Rechts():99 pwmMotorLinksVooruit.ChangeDutyCycle(0)100 pwmMotorLinksAchteruit.ChangeDutyCycle(snelheidWielLinks * snelheidMaal)101 pwmMotorRechtsVooruit.ChangeDutyCycle(snelheidWielRechts * snelheidMaal)102 pwmMotorRechtsAchteruit.ChangeDutyCycle(0)103#---------------------------------------------------------104'''FUNCITE VOOR AFSTAND METEN'''105def meetAfstand():106 GPIO.output(pinStuurSignaal, True)107 time.sleep(0.00001)108 GPIO.output(pinStuurSignaal, False)109 StartTime = time.time()110 StopTime = StartTime111 while GPIO.input(pinOntvangSignaal) == 0:112 StartTime = time.time()113 StopTime = StartTime114 while GPIO.input(pinOntvangSignaal) == 1:115 StopTime = time.time()116 return ((StopTime-StartTime)*34326)/​2117#---------------------------------------------------------118'''DETECTEREN VAN OBSTAKEL'''119def isObstakel(lokaleHoeDichtBij):120 return meetAfstand() < lokaleHoeDichtBij121#---------------------------------------------------------122'''HOOFDCODE'''123try:124 while True:125 if GPIO.input(pinLichtSensor) == 0:126 rijVooruit()127 GPIO.output(pinLED1, 0)128 GPIO.output(pinLED2, 1)129 else:130 Links()131 GPIO.output(pinLED1, 1)132 GPIO.output(pinLED2, 0)133#CTRL + C stoppen de motoren134except KeyboardInterrupt:135 running = False...

Full Screen

Full Screen

Mick Program.py

Source: Mick Program.py Github

copy

Full Screen

1'''IMPORTEREN VAN ALLE LIBRARY'S'''2import RPi.GPIO as GPIO3import time4import random5#---------------------------------------------------------6'''PINMODES AANGEVEN'''7GPIO.setmode(GPIO.BCM)8GPIO.setwarnings(False)9#---------------------------------------------------------10'''OP WELKE PINS ZITTEN DE MOTOREN'''11pinLinksVooruit = 1012pinLinksAchteruit = 913pinRechtsVooruit = 814pinRechtsAchteruit = 715#---------------------------------------------------------16'''OP WELKE PINS ZITTEN DE 'OGEN' '''17pinStuurSignaal = 1718pinOntvangSignaal = 1819#---------------------------------------------------------20'''OP WELKE PINS ZITTEN DE LICHTSENSOREN'''21pinLichtSensor = 2522#---------------------------------------------------------23'''OP WELKE PINS ZITTEN DE LEDJES'''24pinLED1 = 2225pinLED2 = 2326#----------------------------------------------------------27'''FREQUENTIE VAN DE WIELEN, HOEVAAK AAN/​UIT PER SECONDE'''28frequentie = 1029#---------------------------------------------------------30'''PROCENTEN DAT DE WIELEN AAN MOETEN STAAN'''31rondjesLinks = 5032rondjesRechts = 3033#---------------------------------------------------------34'''VARIABELE VOOR HET STOPPEN VAN DE AUTO'''35stop = 036#---------------------------------------------------------37'''ZIJN DE PINNEN IN/​OUT-PUT'''38GPIO.setup(pinLinksVooruit, GPIO.OUT)39GPIO.setup(pinLinksAchteruit, GPIO.OUT)40GPIO.setup(pinRechtsVooruit, GPIO.OUT)41GPIO.setup(pinRechtsAchteruit, GPIO.OUT)42GPIO.setup(pinStuurSignaal, GPIO.OUT)43GPIO.setup(pinOntvangSignaal, GPIO.IN)44GPIO.setup(pinLichtSensor, GPIO.IN)45GPIO.setup(pinLED1, GPIO.OUT)46GPIO.setup(pinLED2, GPIO.OUT)47#---------------------------------------------------------48'''VARIABELEN VOOR AFSTANDSMETING'''49hoeDichtBij = 35.050draaiTijd = 0.7551#---------------------------------------------------------52'''ZET PWM OP 'FREQUENTIE' '''53pwmMotorLinksVooruit = GPIO.PWM(pinLinksVooruit, frequentie)54pwmMotorLinksAchteruit = GPIO.PWM(pinLinksAchteruit, frequentie)55pwmMotorRechtsVooruit = GPIO.PWM(pinRechtsVooruit, frequentie)56pwmMotorRechtsAchteruit = GPIO.PWM(pinRechtsAchteruit, frequentie)57#---------------------------------------------------------58'''ZET ALLES UIT'''59pwmMotorLinksVooruit.start(stop)60pwmMotorLinksAchteruit.start(stop)61pwmMotorRechtsVooruit.start(stop)62pwmMotorRechtsAchteruit.start(stop)63#---------------------------------------------------------64'''FUNCTIE VOOR ALLE MOTORS UIT'''65def motorsUit():66 pwmMotorLinksVooruit.ChangeDutyCycle(stop)67 pwmMotorLinksAchteruit.ChangeDutyCycle(stop)68 pwmMotorRechtsVooruit.ChangeDutyCycle(stop)69 pwmMotorRechtsAchteruit.ChangeDutyCycle(stop)70#---------------------------------------------------------71'''FUNCTIE VOOR VOORUIT'''72def rijVooruit():73 pwmMotorLinksVooruit.ChangeDutyCycle(rondjesLinks)74 pwmMotorLinksAchteruit.ChangeDutyCycle(stop)75 pwmMotorRechtsVooruit.ChangeDutyCycle(rondjesRechts)76 pwmMotorRechtsAchteruit.ChangeDutyCycle(stop)77#---------------------------------------------------------78'''FUNCTIE VOOR ACHTERUIT'''79def rijAchteruit():80 pwmMotorLinksVooruit.ChangeDutyCycle(stop)81 pwmMotorLinksAchteruit.ChangeDutyCycle(rondjesLinks)82 pwmMotorRechtsVooruit.ChangeDutyCycle(stop)83 pwmMotorRechtsAchteruit.ChangeDutyCycle(rondjesRechts)84'''FUNCTIE VOOR LINKS'''85def Links():86 pwmMotorLinksVooruit.ChangeDutyCycle(stop)87 pwmMotorLinksAchteruit.ChangeDutyCycle(rondjesLinks)88 pwmMotorRechtsVooruit.ChangeDutyCycle(rondjesRechts)89 pwmMotorRechtsAchteruit.ChangeDutyCycle(stop)90#---------------------------------------------------------91'''FUNCTIE VOOR RECHTS'''92def Rechts():93 pwmMotorLinksVooruit.ChangeDutyCycle(rondjesLinks)94 pwmMotorLinksAchteruit.ChangeDutyCycle(stop)95 pwmMotorRechtsVooruit.ChangeDutyCycle(stop)96 pwmMotorRechtsAchteruit.ChangeDutyCycle(rondjesRechts)97#---------------------------------------------------------98'''FUNCITE VOOR AFSTAND METEN'''99def meetAfstand():100 GPIO.output(pinStuurSignaal, True)101 time.sleep(0.00001)102 GPIO.output(pinStuurSignaal, False)103 StartTime = time.time()104 StopTime = StartTime105 while GPIO.input(pinOntvangSignaal) == 0:106 StartTime = time.time()107 StopTime = StartTime108 while GPIO.input(pinOntvangSignaal) == 1:109 StopTime = time.time()110 return ((StopTime-StartTime)*34326)/​2111#---------------------------------------------------------112'''DETECTEREN VAN OBSTAKEL'''113def isObstakel(lokaleHoeDichtBij):114 return meetAfstand() < lokaleHoeDichtBij115#---------------------------------------------------------116'''HOOFDCODE'''117try:118 while True:119 if GPIO.input(pinLichtSensor) == 0:120 GPIO.output(pinLED1, 1)121 GPIO.output(pinLED2, 0)122 Links()123 print "Wit"124 else:125 GPIO.output(pinLED1, 0)126 GPIO.output(pinLED2, 1)127 rijVooruit()128 print "Zwart"129#CTRL + C stoppen de motoren130except KeyboardInterrupt:...

Full Screen

Full Screen

walkTheLine.py

Source: walkTheLine.py Github

copy

Full Screen

1'''IMPORTEREN VAN ALLE LIBRARY'S'''2import RPi.GPIO as GPIO3import time4import random5#---------------------------------------------------------6'''PINMODES AANGEVEN'''7GPIO.setmode(GPIO.BCM)8GPIO.setwarnings(False)9#---------------------------------------------------------10'''OP WELKE PINS ZITTEN DE MOTOREN'''11pinLinksVooruit = 1012pinLinksAchteruit = 913pinRechtsVooruit = 814pinRechtsAchteruit = 715#---------------------------------------------------------16'''OP WELKE PINS ZITTEN DE 'OGEN' '''17pinStuurSignaal = 1718pinOntvangSignaal = 1819#---------------------------------------------------------20'''OP WELKE PINS ZIT DE LICHTSENSOR'''21pinCheckLijn = 2522'''OP WELKE PINS ZITTEN DE LEDJES'''23pinLED1 = 2224pinLED2 = 2325#----------------------------------------------------------26'''FREQUENTIE VAN DE WIELEN, HOEVAAK AAN/​UIT PER SECONDE'''27frequentie = 2528#---------------------------------------------------------29'''PROCENTEN DAT DE WIELEN AAN MOETEN STAAN'''30rondjesLinks = 4031rondjesRechts = 4532#---------------------------------------------------------33'''VARIABELE VOOR HET STOPPEN VAN DE AUTO'''34stop = 035#---------------------------------------------------------36'''ZIJN DE PINNEN IN/​OUT-PUT'''37GPIO.setup(pinLinksVooruit, GPIO.OUT)38GPIO.setup(pinLinksAchteruit, GPIO.OUT)39GPIO.setup(pinRechtsVooruit, GPIO.OUT)40GPIO.setup(pinRechtsAchteruit, GPIO.OUT)41GPIO.setup(pinStuurSignaal, GPIO.OUT)42GPIO.setup(pinOntvangSignaal, GPIO.IN)43GPIO.setup(pinCheckLijn, GPIO.IN)44GPIO.setup(pinLED1, GPIO.OUT)45GPIO.setup(pinLED2, GPIO.OUT)46#---------------------------------------------------------47'''ZET PWM OP 'FREQUENTIE' '''48pwmMotorLinksVooruit = GPIO.PWM(pinLinksVooruit, frequentie)49pwmMotorLinksAchteruit = GPIO.PWM(pinLinksAchteruit, frequentie)50pwmMotorRechtsVooruit = GPIO.PWM(pinRechtsVooruit, frequentie)51pwmMotorRechtsAchteruit = GPIO.PWM(pinRechtsAchteruit, frequentie)52#---------------------------------------------------------53'''ZET ALLES UIT'''54pwmMotorLinksVooruit.start(stop)55pwmMotorLinksAchteruit.start(stop)56pwmMotorRechtsVooruit.start(stop)57pwmMotorRechtsAchteruit.start(stop)58#---------------------------------------------------------59'''FUNCTIE VOOR ALLE MOTORS UIT'''60def motorsUit():61 pwmMotorLinksVooruit.ChangeDutyCycle(stop)62 pwmMotorLinksAchteruit.ChangeDutyCycle(stop)63 pwmMotorRechtsVooruit.ChangeDutyCycle(stop)64 pwmMotorRechtsAchteruit.ChangeDutyCycle(stop)65#---------------------------------------------------------66'''FUNCTIE VOOR VOORUIT'''67def rijVooruit():68 pwmMotorLinksVooruit.ChangeDutyCycle(rondjesLinks)69 pwmMotorLinksAchteruit.ChangeDutyCycle(stop)70 pwmMotorRechtsVooruit.ChangeDutyCycle(rondjesRechts)71 pwmMotorRechtsAchteruit.ChangeDutyCycle(stop)72#---------------------------------------------------------73'''FUNCTIE VOOR ACHTERUIT'''74def rijAchteruit():75 pwmMotorLinksVooruit.ChangeDutyCycle(stop)76 pwmMotorLinksAchteruit.ChangeDutyCycle(rondjesLinks)77 pwmMotorRechtsVooruit.ChangeDutyCycle(stop)78 pwmMotorRechtsAchteruit.ChangeDutyCycle(rondjesRechts)79'''FUNCTIE VOOR LINKS'''80def Links():81 pwmMotorLinksVooruit.ChangeDutyCycle(stop)82 pwmMotorLinksAchteruit.ChangeDutyCycle(rondjesLinks)83 pwmMotorRechtsVooruit.ChangeDutyCycle(rondjesRechts)84 pwmMotorRechtsAchteruit.ChangeDutyCycle(stop)85#---------------------------------------------------------86'''FUNCTIE VOOR HALFLINKS'''87def HalfLinks():88 pwmMotorLinksVooruit.ChangeDutyCycle(stop)89 pwmMotorLinksAchteruit.ChangeDutyCycle(stop)90 pwmMotorRechtsVooruit.ChangeDutyCycle(rondjesRechts)91 pwmMotorRechtsAchteruit.ChangeDutyCycle(stop)92#---------------------------------------------------------93'''FUNCTIE VOOR RECHTS'''94def Rechts():95 pwmMotorLinksVooruit.ChangeDutyCycle(rondjesLinks)96 pwmMotorLinksAchteruit.ChangeDutyCycle(stop)97 pwmMotorRechtsVooruit.ChangeDutyCycle(stop)98 pwmMotorRechtsAchteruit.ChangeDutyCycle(rondjesRechts)99 100'''FUNCTIE VOOR HALFRECHTS'''101def HalfRechts():102 pwmMotorLinksVooruit.ChangeDutyCycle(rondjesLinks)103 pwmMotorLinksAchteruit.ChangeDutyCycle(stop)104 pwmMotorRechtsVooruit.ChangeDutyCycle(stop)105 pwmMotorRechtsAchteruit.ChangeDutyCycle(stop)106#---------------------------------------------------------107'''DETECTEREN VAN LIJN'''108try:109 while True:110 #Als de sensor geen licht oppikt is het oppervlak zwart, gaat het autootje naar rechts en het rechterlampje aan111 if GPIO.input(pinCheckLijn)==0:112 GPIO.output(pinLED1, 1)113 GPIO.output(pinLED2, 0)114 Rechts()115 #Als de sensor wel iets oppikt gaat het autootje naar links en het linker lampje aan116 else:117 GPIO.output(pinLED2, 1)118 GPIO.output(pinLED1, 0)119 HalfLinks()120 121#Stop het script met CTRL + C 122except KeyboardInterrupt:...

Full Screen

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

Feeding your QA Career – Developing Instinctive &#038; Practical Skills

The QA testing profession requires both educational and long-term or experience-based learning. One can learn the basics from certification courses and exams, boot camp courses, and college-level courses where available. However, developing instinctive and practical skills works best when built with work experience.

A Complete Guide To CSS Grid

Ever since the Internet was invented, web developers have searched for the most efficient ways to display content on web browsers.

Keeping Quality Transparency Throughout the organization

In general, software testers have a challenging job. Software testing is frequently the final significant activity undertaken prior to actually delivering a product. Since the terms “software” and “late” are nearly synonymous, it is the testers that frequently catch the ire of the whole business as they try to test the software at the end. It is the testers who are under pressure to finish faster and deem the product “release candidate” before they have had enough opportunity to be comfortable. To make matters worse, if bugs are discovered in the product after it has been released, everyone looks to the testers and says, “Why didn’t you spot those bugs?” The testers did not cause the bugs, but they must bear some of the guilt for the bugs that were disclosed.

A Detailed Guide To Xamarin Testing

Xamarin is an open-source framework that offers cross-platform application development using the C# programming language. It helps to simplify your overall development and management of cross-platform software applications.

How To Run Cypress Tests In Azure DevOps Pipeline

When software developers took years to create and introduce new products to the market is long gone. Users (or consumers) today are more eager to use their favorite applications with the latest bells and whistles. However, users today don’t have the patience to work around bugs, errors, and design flaws. People have less self-control, and if your product or application doesn’t make life easier for users, they’ll leave for a better solution.

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run SeleniumBase automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful