Go to advanced search

by Joseph C.
Fri Jan 03, 2020 9:26 pm
Forum: Python
Topic: GPIO Zero: How to Increment Servo to Initial Angle instead of Max Angle.
Replies: 1
Views: 180

GPIO Zero: How to Increment Servo to Initial Angle instead of Max Angle.

I have a program for incrementing a servo motor by 1 degree using GPIO zero, but the problem is I want the servo to increment only to the middle angle not the maximum angle. Increment Program: wanted_angleNS = servoNS.angle + 1 if wanted_angleNS > servoNS.max_angle: servoNS.max() sleep(0.1) else: se...
by Joseph C.
Wed Jan 01, 2020 12:39 am
Forum: Python
Topic: GPIO zero keeps giving "OutputDeviceBadValue"
Replies: 10
Views: 664

Re: GPIO zero keeps giving "OutputDeviceBadValue"

Thank you Paeryn and pcmanbob for explanation and help with my servo issues. :D
by Joseph C.
Tue Dec 31, 2019 10:37 pm
Forum: Python
Topic: How to Read ADC Channel Values through GPIOzero library?
Replies: 7
Views: 446

Re: How to Read ADC Channel Values through GPIOzero library?

If I do that, then how would I differentiate the 2 channels (just gpiozero). I was expecting the difference to be from 0 - 1023.
by Joseph C.
Tue Dec 31, 2019 8:55 pm
Forum: Python
Topic: GPIO zero keeps giving "OutputDeviceBadValue"
Replies: 10
Views: 664

Re: GPIO zero keeps giving "OutputDeviceBadValue"

Also, paeryn. I use the += and -= to move my servo motor in increments of +1 and -1, so if those aren't supported on AngularServo, then what should I use? You modify servo01.angle making sure that you don't try to move it past the maximum or minimum, something like :- # Increment by 1 servo01.angle...
by Joseph C.
Tue Dec 31, 2019 8:31 pm
Forum: Python
Topic: GPIO zero keeps giving "OutputDeviceBadValue"
Replies: 10
Views: 664

Re: GPIO zero keeps giving "OutputDeviceBadValue"

pcmanbob, then how am I supposed to differentiate the 2 channels? What I was trying to get across is that using gpiozero you produce results in the range 0 to 1 , is this what you are expecting when using the results in your calculations ? or were you expecting the 0 to 1023 results from the adafru...
by Joseph C.
Mon Dec 30, 2019 11:24 pm
Forum: Python
Topic: GPIO zero keeps giving "OutputDeviceBadValue"
Replies: 10
Views: 664

Re: GPIO zero keeps giving "OutputDeviceBadValue"

pcmanbob, then how am I supposed to differentiate the 2 channels?

Also, paeryn. I use the += and -= to move my servo motor in increments of +1 and -1, so if those aren't supported on AngularServo, then what should I use?
by Joseph C.
Mon Dec 30, 2019 5:59 pm
Forum: Python
Topic: GPIO zero keeps giving "OutputDeviceBadValue"
Replies: 10
Views: 664

GPIO zero keeps giving "OutputDeviceBadValue"

I am using the AngularServo part of GPIO zero, but whenever I run the code, it displays: gpiozero.exc.OutputDeviceBadValue: AngularServo angle must be between 45 and 135, or None What do I do? My full program: from gpiozero import AngularServo from time import sleep import RPi.GPIO as GPIO from gpio...
by Joseph C.
Mon Dec 30, 2019 5:22 pm
Forum: Python
Topic: Raspberry PI keeps giving Syntax Error when I see nothing wrong
Replies: 4
Views: 224

Re: Raspberry PI keeps giving Syntax Error when I see nothing wrong

Code: Select all

Traceback (most recent call last):
  File "/home/pi/Documents/EWservomovement.py", line 23
    for newAngle in range(servo01.angle, targetAngle, stepSize)
                                                              ^
SyntaxError: invalid syntax
by Joseph C.
Mon Dec 30, 2019 4:59 pm
Forum: Python
Topic: Raspberry PI keeps giving Syntax Error when I see nothing wrong
Replies: 4
Views: 224

Raspberry PI keeps giving Syntax Error when I see nothing wrong

When I try to Run my program in the Python 3.7.3 IDE, line 22 keeps showing syntax error, but I see nothing wrong. for newAngle in range(servo01.angle, targetAngle, stepSize) My full program: from gpiozero import AngularServo from time import sleep import RPi.GPIO as GPIO from gpiozero import MCP300...
by Joseph C.
Mon Dec 30, 2019 4:47 pm
Forum: Python
Topic: How to Read ADC Channel Values through GPIOzero library?
Replies: 7
Views: 446

Re: How to Read ADC Channel Values through GPIOzero library?

I mean I did that, so I can use the Adafruit library to print the readings to the screen 0 - 1023 since the GPIO zero library didn't do that. Then I used the GPIO zero library to do the actual calculations.
by Joseph C.
Sun Dec 29, 2019 5:27 pm
Forum: Python
Topic: How to Read ADC Channel Values through GPIOzero library?
Replies: 7
Views: 446

Re: How to Read ADC Channel Values through GPIOzero library?

Can I use the GPIO zero library to read the values and use the Adafruit MCP3008 Python library to print the values onto a terminal window? For example: from gpiozero import MCP3008 #uses the GPIOzero library to communicate with the MCP3008 ADC import Adafruit_GPIO.SPI as SPI import Adafruit_MCP3008 ...
by Joseph C.
Sun Dec 29, 2019 4:27 pm
Forum: Python
Topic: How to Read ADC Channel Values through GPIOzero library?
Replies: 7
Views: 446

How to Read ADC Channel Values through GPIOzero library?

I am using the MCP3008 to read values for 4 light sensors for a Dual-Axis solar tracker, but I am not sure how to read the channel values off the terminal window. I am using the GPIOzero library to interface with the ADC converter. Can you please help?
by Joseph C.
Fri Dec 27, 2019 4:40 pm
Forum: Python
Topic: Making my servo move in increments/decrements of 1 degree
Replies: 10
Views: 674

Re: Making my servo move in increments/decrements of 1 degree

But how do I make it move continuously? I need it to move continuously to follow the Sun's movement. I have a continuous servo motor.
by Joseph C.
Fri Dec 27, 2019 3:44 pm
Forum: Python
Topic: Making my servo move in increments/decrements of 1 degree
Replies: 10
Views: 674

Re: Making my servo move in increments/decrements of 1 degree

I mean on Arduino there is a code that is:

Code: Select all

servo.write()
This changes the servo's position. I want to know if there is something similar.
by Joseph C.
Fri Dec 27, 2019 3:18 pm
Forum: Python
Topic: Making my servo move in increments/decrements of 1 degree
Replies: 10
Views: 674

Re: Making my servo move in increments/decrements of 1 degree

I am doing the solar tracker in a small model for a science fair project. I used an arduino last year and I could move the servo motors position continuously using "++" and "--" increments. I just wanted to know if there is something I could do the same.
by Joseph C.
Fri Dec 27, 2019 2:39 pm
Forum: Python
Topic: Making my servo move in increments/decrements of 1 degree
Replies: 10
Views: 674

Making my servo move in increments/decrements of 1 degree

I am doing a dual axis solar tracker when the servo motor has to move constantly to respond to the light changes within the sensors, but from programs on how to move a servo motor, it shows to move to a certain angle. Do you know a line of code that can tell the servo motor to move constantly in inc...
by Joseph C.
Fri Dec 27, 2019 2:29 pm
Forum: C/C++
Topic: Using Arduino for analogRead()
Replies: 22
Views: 1883

Re: Using Arduino for analogRead()

rpiMike, could I also compare channel values like:

Code: Select all

v0.value - v1.value
by Joseph C.
Thu Dec 26, 2019 6:29 pm
Forum: C/C++
Topic: Using Arduino for analogRead()
Replies: 22
Views: 1883

Re: Using Arduino for analogRead()

Ok, now that I thought about it, I think I will stop using the wiringpi library and just use the MCP3008 gpiozero library. So my question is how do I compare the values of the reading for 2 channels?
by Joseph C.
Thu Dec 26, 2019 5:49 pm
Forum: C/C++
Topic: Using Arduino for analogRead()
Replies: 22
Views: 1883

Re: Using Arduino for analogRead()

But is it still usable?
by Joseph C.
Thu Dec 26, 2019 5:41 pm
Forum: C/C++
Topic: Using Arduino for analogRead()
Replies: 22
Views: 1883

Re: Using Arduino for analogRead()

Ok, thanks! Although, I also use the wiringpi library for the analogRead() of the sensors, so is this ok:

Code: Select all

while True:
	eastSNSR = analogRead(eastSNSRPin)
	v0 = MCP3008 (channel=0)
Ignore the name for the variables.
by Joseph C.
Thu Dec 26, 2019 5:36 pm
Forum: C/C++
Topic: Using Arduino for analogRead()
Replies: 22
Views: 1883

Re: Using Arduino for analogRead()

how could I get the channels 0,1,2,3 on the MCP3008?Just change the channel from "channel=0" to "channel=1"?
by Joseph C.
Thu Dec 26, 2019 5:32 pm
Forum: Python
Topic: If I use an ADC Converter with my RPi 4, Can I use analogRead()
Replies: 5
Views: 555

Re: If I use an ADC Converter with my RPi 4, Can I use analogRead()

Although, if I use the wiringpi library, I can use analogRead() right?

Go to advanced search