How to set the function setclock for timer.
On Tue, Jan 29, 2019 at 12:11 AM Dennis Lee Bieber <[email protected]> wrote: > On Mon, 28 Jan 2019 01:27:39 -0800 (PST), > [email protected] declaimed the > following: > > >Hello.. > > I am first time work on beaglebone.I want to generate Clock of 3Khz > on > >timer7 (P8_8)pin og beaglebone. > >here is my code. > > > >import Adafruit_BBIO.GPIO as GPIO > >import time > >outpin="P8_8" > >GPIO.setup(outpin,GPIO.OUT) > >GPIO.setclock(outpin,3000) > >while True: > > GPIO.output(outpin,GPIO.HIGH) > > time.sleep(2) > > GPIO.output(outpin,GPIO.LOW) > > time.sleep(2) > > >------------------------------------------------------------------------------------- > >It gives error.. > >GPIO.setclock(outpin,3000) > >AttributeError: 'module' object has no attribute 'setclock' > > > >Please correct me.. > > Well, where did you find any documentation about a .setclock() > function? It doesn't exist in > https://adafruit-beaglebone-io-python.readthedocs.io/en/latest/GPIO.html > so > take it out. > > Furthermore, your while loop takes four seconds to execute -- that > equates to a frequency of 0.25Hz. Generating a 3kHz square wave would > require time.sleep(0.000166666666) -- presuming the OS clock allows for > sleeps that small (note: you will also be affected by any OS pre-emption of > your program). [Total loop time 0.000333333] > > Perhaps you really want to be using the PWM function > https://adafruit-beaglebone-io-python.readthedocs.io/en/latest/PWM.html > > > -- > Wulfraed Dennis Lee Bieber AF6VN > [email protected] HTTP://wlfraed.home.netcom.com/ > > -- > For more options, visit http://beagleboard.org/discuss > --- > You received this message because you are subscribed to a topic in the > Google Groups "BeagleBoard" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/beagleboard/znMvwYwvrgY/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/beagleboard/mjiu4epofo8eth2jdimfid58mtv34gffnf%404ax.com > . > For more options, visit https://groups.google.com/d/optout. > -- For more options, visit http://beagleboard.org/discuss --- You received this message because you are subscribed to the Google Groups "BeagleBoard" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/CAC6i%3DDKy%3DwdOmgS4Gk5Z1ciLPSdxuk6wjwbaeaU7JQs8Rna8dA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
