Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Jason

Pages: 1 ... 3 4 5 6 7 8
61
You should be able to hold the sensor flat and still, record the number on the axis with the largest magnitude, and then divide each axis with that number after getting the readings. Now you'll have all the readings normalized to gravity, so just multiply the readings by 9.8 after dividing them.

The value I recorded was -261.0 on the z-axis, so I'll divide each axis by its magnitude and then multiply by 9.8
Code: [Select]
#include <Wire.h>
#include "BMA250.h"


BMA250 accel_sensor;
int x, y, z;


#if defined(ARDUINO_ARCH_SAMD)
 #define SerialMonitorInterface SerialUSB
#else
 #define SerialMonitorInterface Serial
#endif


void setup() {
  SerialMonitorInterface.begin(115200);
  Wire.begin();

  SerialMonitorInterface.print("Initializing BMA...");
  // Set up the BMA250 acccelerometer sensor
  accel_sensor.begin(BMA250_range_2g, BMA250_update_time_64ms);
}


void loop() {
  accel_sensor.read();//This function gets new data from the acccelerometer

  // Get the acceleration values from the sensor and store them into global variables
  // (Makes reading the rest of the program easier)
  x = accel_sensor.X;
  y = accel_sensor.Y;
  z = accel_sensor.Z;

  if (x == -1 && y == -1 && z == -1) {
    SerialMonitorInterface.print("ERROR! NO BMA250 DETECTED!");
  }
 
  else {
    showSerial();
  }

  delay(250);
}


void showSerial() {
  SerialMonitorInterface.print("X = ");
  SerialMonitorInterface.print((x / 261.0f) * 9.8f);
 
  SerialMonitorInterface.print("  Y = ");
  SerialMonitorInterface.print((y / 261.0f) * 9.8f);
 
  SerialMonitorInterface.print("  Z = ");
  SerialMonitorInterface.println((z / 261.0f) * 9.8f);
}

You could simplify the conversion math by combining the constant values: 9.8/261.0 =  0.0375. Now I can convert each axis this way:
Code: [Select]
void showSerial() {
  SerialMonitorInterface.print("X = ");
  SerialMonitorInterface.print(x * 0.0375f);
 
  SerialMonitorInterface.print("  Y = ");
  SerialMonitorInterface.print(y * 0.0375f);
 
  SerialMonitorInterface.print("  Z = ");
  SerialMonitorInterface.println(z * 0.0375f);
}

62
Wirelings / Re: wireling Pi HAT config error
« on: March 03, 2023, 10:48:21 AM »
I'm using the AST1001 accelerometer and the wireling Pi HAT. The Raspberry Pi I'm using is the same as yours and I installed the newest version of the OS. I just use a new SD card and downloaded the newest OS in it and run this OS on Raspberry Pi 3 v1.2 board.

Could you try following the steps in this link? https://stackoverflow.com/a/74147334

What is the value of 'revision' in the output of the first command?
Code: [Select]
cat /proc/cpuinfo
For me it is a22082

63
Wirelings / Re: wireling Pi HAT config error
« on: February 28, 2023, 11:48:18 AM »
I was able to get that example working fine on my Raspberry Pi 3 Model B V1.2.

Can you provide the following?
  • Board name
  • Board version
  • OS name
  • OS version

64
Thumby / Re: Thumby Softlocked / Unresponsive
« on: February 17, 2023, 10:20:40 AM »
You can try manually updating it by following the directions here https://thumby.us/FAQ/ in the last bullet point under "Why is my Thumby not connecting to the Web Code Editor?"

To make it easier, follow the steps in the image attached to my comment. Here's the link for the firmware image from those steps: https://github.com/TinyCircuits/TinyCircuits-Thumby-Code-Editor/raw/master/ThumbyFirmware.uf2

65
Thumby / Re: screen just wont work after reformat
« on: October 17, 2022, 09:59:36 AM »
For anyone else reading this, we handled this on Discord.

If the UF2 reformatting didn't work then it must be some other problem.

66
Thumby / Re: Background art resources
« on: September 29, 2022, 12:54:43 PM »
@Jason - I appreciate the testing and review.

Currently assigning the bitmap to a Sprite class is commented out as default.  I figured this wasted RAM (/ program memory?) if the user chooses another blitting method or if the sprite is never used...?
Is that a fair assumption?
Might the API be extended in the future, with other blitting classes? (e.g. simple non-masked bitmap, or a screen pattern fill, etc.)

Commenting the sprite by default seems like a good idea. As you said, it would use ram.

The Thumby API is always open to being extended. I think a pattern fill function would be great!

Right now, the Thumby API lives here: https://github.com/TinyCircuits/TinyCircuits-Thumby-Code-Editor/tree/master/ThumbyGames

67
Thumby / Re: Background art resources
« on: September 29, 2022, 10:41:48 AM »
Thanks Jason.
I'm new to Python and Thumby... does the generated code look reasonable?
I'd like to refine it to 100%, before converting hundreds of images!  ;D

Yup, looks good enough.

I also tested it on Thumby and the emulator and it works. Importing the comment string into the bitmap builder is also functional.

68
Thumby / Re: Background art resources
« on: September 28, 2022, 06:11:50 PM »
This is really cool! Once you're in a good spot we should add a link to this in the documentation, or something like that.

You should link this in the Discord: https://discord.gg/nkwR3WBBXD

69
It looks like this is at least nearly a solved problem.  Could you post more specifics of what was done and what is and isn't working?  I would like to use tinyscreen+ and tinyzero with PlatformIO.

Thanks

This was a year ago. Things may have changed since then.

Have you tried using a TinyScreen+ or TinyZero with PlatformIO? What errors are you getting?

70
Thumby / Re: Can't connect thumby to editor on Linux
« on: June 10, 2022, 12:44:34 PM »
Try adding your user to the dialout group:
Code: [Select]
sudo adduser $USER dialout
You may need to log out and back in or reboot afterwards

71
Thumby / Re: Thumby Code Editor Issues
« on: April 28, 2022, 04:13:57 PM »
I feel more and more that's it's an emulator issue, I keep listing my files every execution. Sometime a file is missing and just with code changes it reappears.

On the emulator page, there is a list of files, are all those file supposed to be accessible, because it seems to fit all my files that are set to emulate (the white checkmark). But not all of them are available when the emulator is started?

Anyone has any pointer for this issue? I'm thinking of migrating all my data to a python .py file so I don't have to fight this issue, but it just doesn't feel right

I agree that it sounds like an emulator issue.

I may have time to look at it soon.

72
Thumby / Re: Error while trying to send data through link cable
« on: April 26, 2022, 05:31:46 PM »
Correct. You can see where that prints here: https://github.com/TinyCircuits/TinyCircuits-Thumby-Code-Editor/blob/master/ThumbyGames/lib/thumby.py#L585

The max packet size can only be 512 bytes when using the built in link API

73
Thumby / Re: Thumby Code Editor Issues
« on: April 25, 2022, 10:12:15 AM »
These are issues that we are working on addressing. In the meantime,

  • Use Utilities -> Widgets -> + Editor (this should be a simple + icon in the future)
  • Make sure to check the white emulation box on the sprite data file and that it's path is where you expect (hover over the file tab)
  • Bitmap Builder and the sprite importer will likely be combined at some point
  • You can write to a file in the emulator but it will not be there the next time it starts. You can print to the shell from hardware or the emulator using print() (a standard Python function)

74
Thumby comes preloaded with 5 games that you can access through the main menu by pressing the down DPAD direction.

You can program games using our web code editor: https://code.thumby.us/ or download other people's creations: https://arcade.thumby.us/ (these will also be accessible through the main menu after turning Thumby off and on)

If you want to learn more about programming or using the code editor, try our documentation site: https://thumby.us/

75
Thumby / Re: Unable to connect my Thumby to the computer
« on: April 08, 2022, 03:50:57 PM »
Quote
(Edit.) Oh yeah, I have no idea if it's relevant or not, but when I was playing for the first time I think the Thumb froze once? I had played Space Debris for maybe ten minutes or something when the game just stopped responding, only staying on the last unmoving screen I saw before the freeze. After I turned the whole thing off and on again it seemed to work normally.

Probably not relevant.

You can try the following
  • Try a different USB cable (even though it was the one sent, maybe it was defective)
  • Try seeing if the device is recognized in BOOTSEL mode. Do the following to get to BOOTSEL mode: plug Thumby into a computer, turn Thumby off, hold the DPAD down direction, turn Thumby on. A file explorer should pop up or a drive called "RPI-RP2" should auto mount. This should tell us that something is wrong with the Thumby firmware and needs to be reformatted
  • Reformat the Thumby firmware by dragging and dropping this file into the RPI-RP2 volume: https://github.com/TinyCircuits/TinyCircuits-Thumby-Code-Editor/raw/master/ThumbyFinal03222022.uf2


Pages: 1 ... 3 4 5 6 7 8
SMF spam blocked by CleanTalk