Thanks for the assist! This saved me time in working out what to do.
Posts made by Denver Pollock
RE: [Resolved] SSH from Omega to Linux Server without Password
RE: SR04T Ultrasonic sensor
@luz thanks for your help. I have checked the pins and they are definitely set to GPIO. I believe the problem is with the while loop in the program. For some reason it is not running any commands in the loop. I thought someone else would have used an ultrasonic sensor and had a python program that worked.
I am still looking for a solution to the problem if anyone else has a suggestion.
SR04T Ultrasonic sensor
I am currently using a SR04T to measure a distance. I am using the same program that I have previously used on a raspberry pi, however, it does not work. I have updated the GPIO references to suit pyOnionGpio. The error is occurring in the While loop. Can someone tell me where I am going wrong?
#This program is to be added to crontab for 15min updates
speedSound = 34300 #Speed of sound in cm/s at temperature
Define GPIO for sensors
GPIO_TRIGGER = onionGpio.OnionGpio(0)
GPIO_ECHO = onionGpio.OnionGpio(1)
Set pins as output and input
GPIO_TRIGGER.setOutputDirection(0) # Trigger
GPIO_ECHO.setInputDirection() # Echo
GPIO_TRIGGER.setValue(0) # Set trigger to False (Low)
time.sleep(0.5) # Allow module to settle
GPIO_TRIGGER.setValue(1) # Send 10us pulse to trigger
time.sleep(0.0001) # Wait 10us
GPIO_TRIGGER.setValue(0) # Trigger
start = time.time()
while GPIO_ECHO.getValue() == 1:
stop = time.time()
elapsed = stop-start
distance = round((elapsed * speedSound)/2,2)
RE: Charging the power dock with varying power source
Have you had any response yet. i am also curious how this works?