Search found 463 matches

by SpotlightKid
Thu Apr 09, 2015 9:29 pm
Forum: General Discussion and Questions
Topic: const() function
Replies: 17
Views: 31915

Re: const() function

I noticed one thing that doesn't work with const():

Code: Select all

NAME = ALIAS = const(42)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'const' is not defined
Which should be perfectly valid Python syntax. Is this intended?
by SpotlightKid
Wed Apr 08, 2015 4:07 pm
Forum: General Discussion and Questions
Topic: STAccel script in STM32F4 DISC
Replies: 12
Views: 12098

Re: STAccel script in STM32F4 DISC

And here's an adapted version of the USB-HID accelerometer-mouse tutorial: # -*- coding: utf-8 -*- """Move mouse pointer via USB-HID according to accelerometer measurements.""" import pyb from staccel import STAccel FREQ = const(50) MAG = const(30) def set_sw_state(): global sw_state sw_state = not ...
by SpotlightKid
Wed Apr 08, 2015 6:06 am
Forum: General Discussion and Questions
Topic: STAccel script in STM32F4 DISC
Replies: 12
Views: 12098

Re: STAccel script in STM32F4 DISC

Although for me it gives another error: Exception: LIS302DL or LIS3DSH accelerometer not present... I just tested this myself, git the same error and tracked it down. It seems that the call to STAccel.read_id() in STAccel.__init__() always returns 255 instead of the correct value 63. In fact, the f...