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 ... 5 6 7 8
91
Thumby / Re: IDE on Raspberry Pi in Chrome
« on: November 03, 2021, 10:38:12 AM »
Hi,

We are aware. The version you have access to was just to get the emulator ready for testing by the community.

A newer version is being worked on where the emulator is in its own panel. However, because of the high pixel density of the Thumby screen, it is not possible for a typical desktop monitor or TV to render the Thumby screen pixel-perfect at scale. The best anyone can probably hope for is a scale just under 2x larger than the Thumby when emulating.

See the attached screenshot to see what the new version will look like.

92
Thumby / Re: Emulator / Debugging / Log statements
« on: October 26, 2021, 10:50:31 AM »
Glad you found that!

A future update to the IDE will place the emulator in its own panel (kind of like the bitmap builder) and have the emulator print to the shell already on the page.

93
Thumby / Re: Flipping Bitmap Images in Thumby IDE
« on: October 19, 2021, 01:17:32 PM »
Other than having the ability to flip bitmaps, is the drawSprite function basically the same as blit then? And many thanks for the image button; I've been using a pixel art website to design my Thumby sprites, so I won't have to draw them a second time now.

It actually calls the blit function after flipping the data, so yes.

94
Thumby / Re: Flipping Bitmap Images in Thumby IDE
« on: October 19, 2021, 12:13:35 PM »
Hi again,

There is a new 'IMAGE' button in the bitmap builder so you can import images (limit being 72 x 40) to the builder and then export to code.

Also, the
Code: [Select]
drawSprite(...) function allows for mirror on the X & Y axes:
Code: [Select]
thumby.display.drawSprite(inspr, x, y, width, height, mirrorX, mirrorY, key)
See the new Thumby API docs: https://github.com/TinyCircuits/tinycircuits.github.io/blob/master/ThumbyAPI.md

95
Thumby / Re: Is the Random Function broken for anyone else?
« on: October 18, 2021, 10:55:53 AM »
The random number returning the same number should happen both on hardware and in the emulator.

In the case of your game, a more reliable way to seed the random number generator is to feed
Code: [Select]
random.seed(seed) the passed time/ticks using
Code: [Select]
time.ticks_us() or
Code: [Select]
time.ticks_ms() after the user selects a character. It is unlikely that a user will select a character at the same milli or micro second each time (unless maybe they hold down the button from game start each time).

96
Thumby / Re: Extracting sprites from bitmap data?
« on: October 18, 2021, 10:46:38 AM »
The sprite arrays only define the pixels of the sprite, not any positional data.

The Thumby blit function allows you to draw sprites anywhere on the screen:
Code: [Select]
thumby.display.blit(bitmapData, x, y, width, height, key) where x and y are relative to the top-left of the screen at 0,0 (left to right is +x and top to bottom is +y) but I think you already know that.

One way to do this in a compact way is to make a function that takes a string and position and then draws/blits each character in the string to the screen based on the position. Each character's width would have to be accounted for too, unless it is monospaced and each character is the same width in which case you draw each character at the same offset from the last. We've done some testing and found that this is slow, now we're looking into building a smaller font into the firmware.

97
Attached is a sketch that will light the LEDS from the base to the top in sequence with 50ms between iterating. After all LEDS are lit, waits 0.5s and turns them back off. LEDS stay lit as the chain progresses.

I hand tweaked the threshold at which the accelerometer needs to move/be jolted before playing the animation. The threshold could potentially need to be lower or higher for each unique piece of hardware. The threshold is low enough now that it sometimes plays the animation as I type on my keyboard.

I removed all other functionally that a typical TinySaber has. Touch does not do anything right now.

Let me know what you think! I'm sure there is plenty of tweaking that needs to be done.

98
Thumby / Re: A quick question
« on: October 14, 2021, 04:45:44 PM »
You can set a pixel color (either 0 or 1) to be not be drawn/be transparent in the thumby.display.blit() function.

The thumby library wraps the MicroPython framebuffer library, so see this: https://docs.micropython.org/en/latest/library/framebuf.html#framebuf.FrameBuffer.blit

For example, the default editor code with the bobbing Thumby sprite has a 32 x 32 black background (the Thumby is drawn in white). Passing '0' as the last parameter in the blit function means all black or 0 pixels will not be drawn.

Try the below code out and look at the blit functions on lines 26 and 29

Code: [Select]
import time
import thumby
import math

# BITMAP: width: 32, height: 32
bitmap0 = (0,0,0,0,0,0,0,0,248,8,232,40,40,40,40,40,40,40,40,40,40,232,8,248,0,0,0,0,0,0,0,0,
           0,0,0,0,0,0,0,0,255,0,63,32,32,32,32,32,32,32,32,32,32,63,0,255,0,0,0,0,0,0,0,0,
           0,0,0,0,0,0,0,0,255,0,12,12,63,63,12,12,0,0,24,24,3,3,0,255,0,0,0,0,0,0,0,0,
           0,0,0,0,0,0,0,0,31,16,16,16,16,20,18,16,20,18,16,16,16,16,16,31,0,0,0,0,0,0,0,0)

while(1):
    t0 = time.ticks_ms()   # Get time (ms)
    thumby.display.fill(0) # Fill canvas to black

    bobRate = 250 # Set arbitrary bob rate (higher is slower)
    bobRange = 5  # How many pixels to move the sprite up/down (-5px ~ 5px)

    # Calculate number of pixels to offset sprite for bob animation
    bobOffset = math.sin(t0 / bobRate) * bobRange

    # Center the sprite using screen and bitmap dimensions and apply bob offset
    spriteX = int((thumby.DISPLAY_W/2) - (32/2))
    spriteY = int(round((thumby.DISPLAY_H/2) - (32/2) + bobOffset))
   
    # Draw sprite normally (0 & 1 pixels drawn)
    thumby.display.blit(bitmap0, spriteX, spriteY, 32, 32)
   
    # Draw sprite halfway overlapping the last sprite but do not draw 0 or black pixels
    thumby.display.blit(bitmap0, spriteX+8, spriteY, 32, 32, 0)
    thumby.display.update()

99
I'll see what I can do

100
Thumby / Re: Flipping Bitmap Images in Thumby IDE
« on: October 13, 2021, 04:25:43 PM »
Hi,

We'll definitely consider adding this feature, thanks for the idea.

Other drawing features are also planned: lines, boxes, fill, etc.

Thanks!

101
Thumby / Re: Emulator?
« on: October 11, 2021, 01:03:45 PM »
Hi,

There actually is an emulator available in the web IDE: https://tinycircuits.github.io/

Just click the "Emulate" button in the code editor

This feature, as well as the web IDE, are in a beta stage of development.

There isn't any documentation/tutorial on how the emulator works just yet.

Let us know about any problems with the IDE or emulator here: https://github.com/TinyCircuits/tinycircuits.github.io/issues

Thanks

102
General Discussion / Re: Problems writing to Flash memory
« on: October 07, 2021, 11:12:53 AM »
Hi,

We don't have any Arduino MKRZERO boards to test the flash shield with.

I assume you are accessing the flash shield pins with a proto shield.

Make sure the following pins are connected from the MKRZERO to the flash shield:
  • MKRZERO SCK    -> flash/proto SCK
  • MKRZERO MISO -> flash/proto MISO
  • MKRZERO MOSI -> flash/proto MOSI
  • MKRZERO digital pin 5  -> flash/proto CS/SS
  • MKRZERO +5v  -> flash/proto VCC
  • MKRZERO GND  -> flash/proto GND

Ensure all connections are separated/not shorting and that they are in the correct spots.

When in the Arduino IDE, verify that the correct board for MKRZERO is selected before upload. This is important, different boards typically have different SPI pin mappings.

Use the below header from the Marzogh SPIMemory library (like in the example you attached) (https://github.com/Marzogh/SPIMemory/releases/tag/v3.4.0)
Code: [Select]
#include <SPIFlash.h>
I was also able to verify the example works on a TinyDuino + USB shield + flash shield.

103
Hi,

Can I get a list of the hardware you are using?

So far I can gather/guess that you have
  • Tinyscreen OLED Tinyshield
  • Adapter Wireling Tinyshield
  • Moisture Sensor Wireling

What processor board are using? You mention "Arduino Pro or Pro Mini" which I assume means you are using the TinyDuino. If that is the case, this will take more investigation.

Anyway, make sure to follow your processor board's tutorial: https://learn.tinycircuits.com/Processors/TinyDuino_Setup_Tutorial/ (use the left panel to find your processor board) so that all relevant libraries and board files get installed.

If you want, follow the tutorial here https://tinycircuits.com/blogs/learn/soil-moisture-sensor-animation (should be a copy from the link you provided) using this example https://github.com/TinyCircuits/TinyCircuits-Main-Site/raw/master/Soil-Moisture-Monitor/program/Soil-Moisture-Monitoring_example.zip project.

Let me know what processor board you have,

Thanks

104
This seems related to your other post. Do my replies there help? http://forum.tinycircuits.com/index.php?topic=2192.msg4957#msg4957

105
General Discussion / Re: "Best" way to send sensor data via BLE?
« on: July 14, 2021, 12:22:12 PM »
Attached is V2 of the example. I would use this one instead of the above since it only allocates memory for packets once instead of every time.

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