sense hat python roll


I´m thinking about getting an Sensehat and im praticing but had an like issue, I use the emulator and print the roll into the console when I turn the rollof the raspi to say 60° everythink is fine but when I turn it to like -171° it displays this : “(‘roll: ‘, 189.01, ‘x: ‘, 9)” (just take a look on the bold part) I know after 180° it continues but how can I like change it to like really be -171° I had the idea of doing like for I in range(181, 360): “do math stuff and put an ‘-‘ in front”

but that would be soo much mowrk stuff todo is there a easier way? .-.

grettings Fabian

put on hold as unclear what you’re asking by MilliwaysDarth Vader Jun 20 at 7:37

Please clarify your specific problem or add additional details to highlight exactly what you need. As it’s currently written, it’s hard to tell exactly what you’re asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

  • what is a roll? … what does do math stuff mean? … you asked only one question, and it is nonsense … please ask a real question – jsotola Jun 19 at 22:15
  • i reread your post several times …. it appears that you are asking a simple arithmeric question that has nothing to do with RPi and nothing to do with programming …. please clarify what it is that you are asking – jsotola Jun 20 at 0:23
  • @Fabian, I feel jealous that you have a senseHat. I read about it in MagPi and also in the news. But I am too poor to afford one. Perhaps I should google and learn, and try to DIY one. Sense HAT – an add-on board for Raspberry Pi, made especially for the Astro Pi mission raspberrypi.org/products/sense-hat – tlfong01 Jun 20 at 2:30    
  • I googled to refresh my memory. raspberrypi.org/products/sense-hat Sense HAT add-on board for Rpi, made especially for the Astro Pi mission – it launched to the International Space Station in Dec 2015 – and is now available to buy. Has 8×8 RGB LED matrix, a five-button joystick and includes the following sensors: Gyroscope, Accelerometer, Magnetometer, Temperature, Barometric pressure, Humidity, We’ve also created a Python library providing easy access to everything on the board. Wow, so it is GyroAcceleroMagnetoBaroHumid (11or 12 DOF?), python, … Still pythoning in space? – tlfong01 Jun 20 at 2:37    
  • To make sure if SH is 10 DOF, I read: 9-DOF for Rpi raspberrypi.stackexchange.com/questions/74865/…Now I am pretty sure SenseHat is 11DOF!. So E14 selling HK$400 is good buy. Need to try my MEMS GyroAccelero soon. Perhaps I should revise my playing notes and see if I can answer @Fabian’s question. He says roll 60 degrees is OK, but no luck when over 180 degrees, or negative something? But I forgot my TRIGONOMETRY. Should youTube again. 🙂 youtube.com/watch?v=R4GLAKEjU4w – tlfong01 Jun 20 at 2:53    
  • I read my answer to the above question and found my own advice: Recommendation to MEMS newbies: MPU9250 will very soon replaced by DOF10 modules. But for newbies who have never played with gyros or acceleros, it is no hurry to start with DOF 9 with magnetos. I think DOF 6 MPU6050 (gyro and accelero) is OK to start. Or to start as easy as possible, I would recommend ADXL345, a very popular accelero, recommended by both SparkFuna and AdaFruit. So to answer @Fabian’s trigonometry question, perhaps I should find the 3DOF ADXL345 which is collecting dust in my junk box, … 🙂 – tlfong01 Jun 20 at 3:06  
  • I am not sure if Rpi Sense Hat is using MPU6050. If yes, then I can use my dusty MPU6050 to help answering @Fabian’s trIgonometery question. So I googled my old learning notes: (1) raspberrypi.org/forums/… (2) raspberrypi.org/forums/… – tlfong01 Jun 20 at 3:20   
  • So I googled to find if SenseHat is using MPU6050. The Sense HAT Rpi – 6 Types of Sensors Device – DevicePlus 2017jun20 (1) deviceplus.com/how-tos/raspberrypi-guide/… DevicePlus’s tutorial is very good for newbies like me. After skimming through the article, I came to a quick and dirty conclusion that even expensive 11 DOF SenseHat is not using my dirt cheap MPU6050 6DOF thing, I can still try the OP’s test and see if I can get good roll readings and thus solve his problem. – tlfong01 Jun 20 at 3:25    
  • I googled further and found that Rpi SenseHat is not using my cheapy MPU5060, but the advanced 9DOF BNO055. (1) Adafruit BNO055 Absolute Orientation Sensor learn.adafruit.com/adafruit-bno055-absolute-orientation-sensor/… (2) BNO055 Datasheet – Bosch cdn-shop.adafruit.com/datasheets/BST_BNO055_DS000_12.pdf I am a newbie and should not start with a 9DOF MEMS. I think I should be humble and MPU6050 should be appropriate for me. 🙂 – tlfong01 Jun 20 at 3:38  
  • @Fabian, it appears that you have a “sign and magnitude” problem. EG, for a particular set of sign and magnitude rules, you roll counter clockwise from +-0 degrees to +90 deg, to +180 deg, then to +190 deg. But if you roll clockwise from +- 0 deg to -90 deg, then to -170 deg. Now, -170 deg is the same as +190 deg. Some other rules might let you roll from 0 to 90, to 180, 270, and back to 0. In other words, it all depends on the rules you use. Perhaps you can use SenseHat’s python library API to set the rules you like, then you don’t need to do any calculations, / to continue, … – tlfong01 Jun 20 at 4:34   
  • To clearyfi my Problem, When i turn the rollslide on the Emulator to like -xxx° it Prinz me like 260 or so degree in the console Im going to post a vid when im home again – Fabian Jun 20 at 5:43
  • Code the Sense HAT in Your Browser! @Fabian, Thank you for your clarification and the video. The video is not clear enough. Since you are using the emulator. Perhaps I will now forget the real thing, and play with the emulator. Just to make sure, are you using the following emulator? “New from Trinket and the Raspberry Pi Foundation: Explore Your World with Sensors and Python” – trinket.io/sense-hat trinket.io/sense-hat – tlfong01 Jun 20 at 6:43   
  • @fabian, the moderators think your question not clear. So I edited like the following. Hope you will like it. “I am using Trinket to emulate Raspberry Pi Sense Hat. I roll 60 degrees and found reading OK. But when I roll to 170 degrees, reading is not correct. Have I done anything wrong? Grettings Fabian” – tlfong01 Jun 20 at 8:23   



  1. I am using Trinket emulator to play with SenseHat.
  2. Rolling to 60° is good, but -171° gives somethings like -189°. Why?


Let me see. I read about SenseHat in MagPi, but I have never seen the real thing, or played with the fake thing using an emulator. Perhaps now I can start playing with the fake thing first, and buy the real thing later.

Now I am playing with trinket on Chinese Windows 10. I wrote a little program to print time and found everything OK, except it is python 2.7, not 3.0. I need to find out how to do python 3.0

Chinese Win10 trinket time

/ to continue, …


Trinket Home Page

Trinket Python Modules

Trinket SenseHat

Trinket Free and Paid Plans

/ to continue, …


Appendix A – Trinket Introduction Web Page

Code the Sense HAT in Your Browser! New from Trinket and the Raspberry Pi Foundation: Explore Your World with Sensors and Python, …

Trinket SenseHat Home Page

Trinket SenseHat

Appendix B – Trinket Python Program – Time

Trinket time

/ to continue, …

Not the answer you’re looking for? Browse other questions tagged   or ask your own question.

Categories: Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: