Jump to content

Zeko9381

Members
  • Posts

    3
  • Joined

  • Last visited

  1. Zeko9381

    Zeko9381

  2. I installed the pyA20 library for controlling GPIO, but I can't get the internal pullup resistor to work anymore. I managed to get it working before, but after playing around with other things, it stopped working. I have a very simple circuit going on, with just a light switch and I'm trying to read the light switch using the internal pull-up resistor. I managed to get it working for a few days, but that's it. I gave up and decided to solder on my own 10K pull-up resistor from the input pin to 3.3V. To my surprise, the results were the same, the input pin floated. Everything works fine with an Arduino. This is all very strange and I hope someone can help me. I'm running all the latest software and kernel.
  3. Ok, this was a pretty dumb post. This example that I found seems to be incorrect. The value for the period isn't in nanoseconds, but in picoseconds, so the correct value would actually be 500000. 500 picosecond period would mean a frequency of 2 MHz, which is way too high. The problem wasn't that the LED took too long to update, but that the resolution at this frequency was way too low.
  4. I'm running the latest 5.10.21-sunxi kernel. I figured out how to use the PWM pin with the help of this post. I have an LED connected to the PWM pin and when I run for example: sudo sh -c "echo 250 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle" the LED updates instantly. But when I try to fade the LED with a script, the LED always takes 6 seconds to update. This is the script: #!/bin/bash #Export PWM channel for user control. sh -c "echo 0 > /sys/class/pwm/pwmchip0/export" #Select the period of PWM signal. Value is in nanoseconds. sh -c "echo 500 > /sys/class/pwm/pwmchip0/pwm0/period" #Change the polarity of the PWM signal. #The polarity can only be changed if the PWM is not enabled. sh -c "echo "normal" > /sys/class/pwm/pwmchip0/pwm0/polarity" #Enable the PWM signal. sh -c "echo 1 > /sys/class/pwm/pwmchip0/pwm0/enable" for i in {0..500} do sh -c "echo $i > /sys/class/pwm/pwmchip0/pwm0/duty_cycle" cat /sys/class/pwm/pwmchip0/pwm0/duty_cycle #Just for debugging sleep 0.1 done #Disable the PWM signal. sh -c "echo 0 > /sys/class/pwm/pwmchip0/pwm0/enable" #UnExport PWM channel for user control. sh -c "echo 0 > /sys/class/pwm/pwmchip0/unexport" I hope someone can help me. It's so hard to find any resources for this sort of thing.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines