Thanks for the assist! This saved me time in working out what to do.
Denver Pollock
@Denver Pollock
Best posts made by Denver Pollock
Latest posts made by Denver Pollock
-
RE: [Resolved] SSH from Omega to Linux Server without Password
-
RE: SR04T Ultrasonic sensor
@James-Behrens Thanks. i pretty much came up with the same solution.
-
RE: SR04T Ultrasonic sensor
@Douglas-Kryder I tried adding print commands through the program and it still showed that it didn't enter While loop even when it should. The program works with a raspberry pi.
-
RE: SR04T Ultrasonic sensor
@Douglas-Kryder great suggestion however I have tried checking the true value of the returned signal and it shows a true value. So it should go into the While loop.
-
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.
-
RE: SR04T Ultrasonic sensor
@Denver-Pollock Can anyone from onion please help me out with this?
-
RE: OnionGpio for Python3
@Neil-Stelling is there any update on how to get GPIO to work for python3?
-
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
import time
import datetime
import onionGpioProgram setup
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() # EchoTaking measurment
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()Calculate distance
elapsed = stop-start
distance = round((elapsed * speedSound)/2,2)
print (distance) -
RE: Charging the power dock with varying power source
Have you had any response yet. i am also curious how this works?