The python file will generate .ino files to render any stl file with lesser than 450 triangles with phong shading on TinyCircuits. Why? I don't know the answer to that either. Also this is a very early project with C, like my 2nd project in C. So don't mind me completely misusing header files. The python file doesn't actually stop you from using an stl file that has more than 450 triangles, but it warns you to maybe not do that. (The RAM in the TinyDuino Processor Board might not be enough for that)
-
TinyDuino Processor Board
-
USB TinyShield
-
TinyScreen - OLED TinyShield
-
Arduino IDE to compile the code
-
Python to generate the TinyCircuits code
These are required to use the stl2triangles.py
file.
numpy
numpy-stl
Modify these variables in stl2triangles.py
according to your needs:
SPRITE_STL_FILE
SCALE
BACKGROUND_COL
PHONG_AMBIANCE_COL
PHONG_AMBIANCE_INTENSITY
PHONG_DIFFUSE_COL
PHONG_DIFFUSE_INTENSITY
PHONG_SPECTRAL_COL
PHONG_SPECTRAL_INTENSITY
SHINYNESS
Where SPRITE_STL_FILE
is the filepath to the STL file, SCALE
determines how big the render will be on the screen, BACKGROUND_COL
is the 8-bit colour of the background on the screen and the rest are material variables according to the Phong Reflection Model
Running stl2triangles.py
with Python will generate a folder .\TinyDuino_Code_Generated\tinycircuits_3D_shading\
containing the TinyCircuit program to render.
Open said folder in Arduino IDE, compile and upload to the TinyDuino Processor Board. Here's a setup tutorial to do so.
Running the stl2triangles.py
file as is in this repository and compiling the generated code will render the below
DrawTriangles.ino
is modified from the source code of Adafruit-GFX-Library/Adafruit_GFX.cpp for use in TinyCircuits. Low_Poly_Dog.stl
is made by AndrewSink