CR555
Published © LGPL

It's snowing again...

A simple application using UNIHIKER K10

BeginnerProtip1 hour87

Things used in this project

Hardware components

DFRobot Unihiker K10
×1
USB Cable, USB Type C Plug
USB Cable, USB Type C Plug
×1

Software apps and online services

DFRobot Mind+

Story

Read more

Schematics

Image

Code

K10-Snow

C/C++
/*!
 * The snow is falling
 *
 */
#include "unihiker_k10.h"
#include "arduino_image_cache.h"

// Dynamic variables
volatile float mind_n_x, mind_n_y;
// Create an object
UNIHIKER_K10 k10;
uint8_t      screen_dir=2;

// snow starting point
int mind_x[8] = {20,50,80,110,140,170,200,230};
int mind_y[8] = {0,0,0,0,0,0,0,0};
int i;

// Main program start
void setup() {
	k10.begin();
	k10.initScreen(screen_dir);
	k10.creatCanvas();
}
void loop() {
int mind_x[8] = {20,50,80,110,140,170,200,230};
int mind_y[8] = {0,0,0,0,0,0,0,0};
	while (1) {
	  k10.canvas->canvasDrawBitmap(0,0,239,315,image_data1);
	  for(i=0;i<9;i++){
	    mind_x[i] = ((int32_t((mind_x[i] + (random(-2, 4+1))))) % (int32_t(240)));
		  mind_y[i] = (mind_y[i] + (random(1, 10+1))) % (int32_t(360));
		  k10.canvas->canvasPoint(mind_x[i], mind_y[i], 0xFFFFFF);
		  delay(10);
	    }
	    		  k10.canvas->updateCanvas();
  }
}

Credits

CR555
6 projects • 11 followers

Comments