Go to advanced search

by joan
Sat Jun 16, 2018 7:40 pm
Forum: C/C++
Topic: GPIO: should I learn sysfs or direct register access?
Replies: 5
Views: 1512

Re: GPIO: should I learn sysfs or direct register access?

GPIO sysfs is deprecated. I expect it will be around for another 10 years or so at least. I'm not very impressed with the /dev/gpiochip replacement.
by joan
Sat Jun 16, 2018 3:54 pm
Forum: C/C++
Topic: Writing data to BCM2835 - SPI
Replies: 24
Views: 682

Re: Writing data to BCM2835 - SPI

Unfortunately the questions show that nothing has been learned from previous answers. There is a clear lack of understanding of SPI which should be understood after a look at wiki. Most of the questions are easily answered by looking at existing SPI code. I can only speak for myself but my patience ...
by joan
Sat Jun 16, 2018 10:17 am
Forum: Advanced users
Topic: Trouble with real-time code
Replies: 13
Views: 425

Re: Trouble with real-time code

monitor.py shows the GPIO levels. It doesn't know or care what mode the GPIO are in (INPUT, OUTPUT, ALT0, ..., ALT5).

What are you trying to do?
by joan
Sat Jun 16, 2018 4:35 am
Forum: Advanced users
Topic: Trouble with real-time code
Replies: 13
Views: 425

Re: Trouble with real-time code

Does http://abyz.me.uk/rpi/pigpio/examples.h ... monitor_py also show a 50ms delay? Perhaps you mean 50µs?
by joan
Sat Jun 16, 2018 4:17 am
Forum: Automation, sensing and robotics
Topic: Motor Driver Not Working
Replies: 6
Views: 211

Re: Motor Driver Not Working

Please add a photo of the connections between the Pi and the motor (including the motor driver board).
by joan
Sat Jun 16, 2018 4:03 am
Forum: General discussion
Topic: Arduino board for only I/O purposes
Replies: 7
Views: 299

Re: Arduino board for only I/O purposes

Use any board you want. However the Pi GPIO must not be exposed to voltages outside the range 0 to 3.3V.
by joan
Sat Jun 16, 2018 3:37 am
Forum: Troubleshooting
Topic: gpio load i2c says module needs to be enabled
Replies: 8
Views: 263

Re: gpio load i2c says module needs to be enabled

Generally yes. If only connected devices respond to their addresses that suggests the I2C bus is functional.

A photo of the connections and a listing of the code being used will help.
by joan
Fri Jun 15, 2018 3:06 pm
Forum: Advanced users
Topic: Trouble with real-time code
Replies: 13
Views: 425

Re: Trouble with real-time code

What are you trying to do?
by joan
Thu Jun 14, 2018 4:52 pm
Forum: Beginners
Topic: GPIO PWM and changing duty cycle
Replies: 7
Views: 192

Re: GPIO PWM and changing duty cycle

As I said, add a delay. The script exits when there are no more commands to execute.
by joan
Thu Jun 14, 2018 3:37 pm
Forum: Beginners
Topic: GPIO PWM and changing duty cycle
Replies: 7
Views: 192

Re: GPIO PWM and changing duty cycle

You need to post code (especially Python) within code quotes so that its meaning can be understood.

I guess the script doesn't work as it finishes a few milliseconds after you run it. Put in a delay.
by joan
Wed Jun 13, 2018 5:48 pm
Forum: Troubleshooting
Topic: gpio load i2c says module needs to be enabled
Replies: 8
Views: 263

Re: gpio load i2c says module needs to be enabled

You should not be using the gpio load command. gpio load predates device tree which made the command redundant.
by joan
Mon Jun 11, 2018 10:19 pm
Forum: Python
Topic: SPI communication both rising/falling edge
Replies: 1
Views: 193

Re: SPI communication both rising/falling edge

I haven't read the spec for the device but I suspect you are overthinking. This sounds like standard SPI. Just use spidev to send/receive as you would for any other device.
by joan
Mon Jun 11, 2018 10:06 pm
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: Wiring multiple i2c together
Replies: 6
Views: 254

Re: Wiring multiple i2c together

TomS-Uk wrote:
Mon Jun 11, 2018 9:55 pm
Bruce_Pi wrote:
Mon Jun 11, 2018 5:25 pm
did you check the pull ups ?
I2C wont work untill you pull SDA and SCL lines high. A 4.7K will be a good choice.
They work without any resistors? I thought a pi has pull ups built in?
Yes, the Pi has 1k8 resistors between GPIO 2/3 and 3V3 specifically for I2C.
by joan
Mon Jun 11, 2018 10:12 am
Forum: Other programming languages
Topic: Problem with PiGPIO in javascript
Replies: 3
Views: 265

Re: Problem with PiGPIO in javascript

I can't help with javascript.

I can offer a diagnostic suggestion.

On the Pi see if you can trace what pigpio is getting in the way of commands.

In a Pi terminal

# turn on debugs
pigs csi 6

#look at debug info
cat /dev/pigerr &

Then run your javascript.
by joan
Sun Jun 10, 2018 9:23 pm
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: Wiring multiple i2c together
Replies: 6
Views: 254

Re: Wiring multiple i2c together

No reason it shouldn't work.

For safety all your devices should be 3V3.

Could you show either a photo of your connections or a detailed schematic?
by joan
Sat Jun 09, 2018 10:10 pm
Forum: Advanced users
Topic: Monitor multiple pi's at once
Replies: 4
Views: 198

Re: Monitor multiple pi's at once

What do you mean by monitor?
by joan
Sat Jun 09, 2018 5:17 pm
Forum: C/C++
Topic: Writing data to BCM2835 - SPI
Replies: 24
Views: 682

Re: Writing data to BCM2835 - SPI

pigpio and the bcm2835 C libraries both control the SPI hardware at this level.
by joan
Sat Jun 09, 2018 1:00 pm
Forum: Beginners
Topic: gpiozero pins as output and set to 0 or 1
Replies: 8
Views: 180

Re: gpiozero pins as output and set to 0 or 1

With pigpio use the following to duplicate the pigs commands. #!/usr/bin/env python import time import pigpio M1A = 4 M1B = 17 M2A = 27 M2B = 22 pi = pigpio.pi() if not pi.connected: exit() pi.write(M1A, 1) pi.write(M1B, 0) time.sleep(1) pi.write(M1A, 0) pi.write(M1B, 1) time.sleep(1) pi.write(M1A, ...
by joan
Sat Jun 09, 2018 10:17 am
Forum: Beginners
Topic: gpiozero pins as output and set to 0 or 1
Replies: 8
Views: 180

Re: gpiozero pins as output and set to 0 or 1

I assume you are using GPIO 4 (pin 7), GPIO 17 (pin 11), GPIO 27 (pin 13), and GPIO 22 (pin 15). To check your motors you can try the following sudo pigpiod # start the pigpio daemon pigs w 4 1 w 17 0 # motor 1 forward pigs w 4 0 w 17 1 # motor 1 backward pigs w 4 0 w 17 0 # stop motor 1 pigs w 27 1...
by joan
Sat Jun 09, 2018 7:14 am
Forum: Beginners
Topic: gpiozero pins as output and set to 0 or 1
Replies: 8
Views: 180

Re: gpiozero pins as output and set to 0 or 1

Add a photo of your connections and describe the motor and motor driver board you are using. Also add a listing of the script you are using (a link is not that useful). gpiozero is a high level wrapper around a number of GPIO libraries. You can think of it as a front end. The back end can be several...
by joan
Fri Jun 08, 2018 11:46 am
Forum: Beginners
Topic: GPIO event detection with break statement
Replies: 5
Views: 137

Re: GPIO event detection with break statement

There is only one while loop. That is the one I mean.

I'm afraid you will have to take the insignificant performance hit of checking the while loop for the exit condition. In fact there is little difference between while True and while not exit_loop.
by joan
Fri Jun 08, 2018 10:25 am
Forum: Beginners
Topic: GPIO event detection with break statement
Replies: 5
Views: 137

Re: GPIO event detection with break statement

You need to specify a function for the callback.

I suggest in the callback function you set a global variable called exit_loop and set it to True.

Then rather than while True: do exit_loop = False and while not exit_loop:
by joan
Fri Jun 08, 2018 7:14 am
Forum: Troubleshooting
Topic: Encoder random value
Replies: 5
Views: 155

Re: Encoder random value

I see no evidence of internal or external pull-ups on GPIO 23/24 so the lines are effectively floating except when pulled to ground.

Add some pull-ups to 3V3 on GPIO 23/24.

Also see http://abyz.me.uk/rpi/pigpio/examples.h ... encoder_py
by joan
Thu Jun 07, 2018 8:03 am
Forum: C/C++
Topic: Raspberry with C++ program
Replies: 17
Views: 769

Re: Raspberry with C++ program

Any C library can be used from C++.

The closest to what you seem to want is http://www.airspayce.com/mikem/bcm2835/

Go to advanced search