new tests
parent
0ebfb91487
commit
e2e8be180f
@ -0,0 +1,59 @@
|
||||
#include "car.h"
|
||||
|
||||
PROGMEM const unsigned char car[] = {
|
||||
|
||||
80,80, //pictureresolution
|
||||
// size is 60 x 60
|
||||
// size is 80 x 80
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xC0, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xE0, 0x0F, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x0F,
|
||||
0x00, 0x80, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x0F, 0x00, 0xE0, 0xFF, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xE0, 0x0F, 0x00, 0xF0, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x0F, 0x00, 0xFC,
|
||||
0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x0F, 0x00, 0xFE, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xE0, 0x0F, 0x00, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x0F, 0xC0, 0xFF, 0x03, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xE0, 0x0F, 0xE0, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x0F,
|
||||
0xF8, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x0F, 0xFC, 0x1F, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xE0, 0x0F, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xCF, 0xFF, 0x03,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xE0, 0xFF, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF,
|
||||
0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xF0, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x3F, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
|
||||
0xFF, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0xF8, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0x0F,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xE0, 0xFF, 0xE7, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0xFF, 0xE1, 0x0F, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xFE, 0x7F, 0xE0, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0x1F,
|
||||
0xE0, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xFF, 0x0F, 0xE0, 0x0F, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0xFC, 0xFF, 0x03, 0xE0, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0xE0, 0x0F,
|
||||
0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0x3F, 0x00, 0xE0, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF,
|
||||
0x7F, 0x00, 0xE0, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0x07, 0xE0, 0x0F, 0x00, 0x00,
|
||||
0x00, 0x00, 0x80, 0xFF, 0xFF, 0x3F, 0xE0, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF,
|
||||
0xE1, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0xFF, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xFE, 0xFF, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0xFF, 0x0F,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0xF8, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0xFF, 0x1F, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xF0, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0xFF, 0x0F, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0xFF, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x8F,
|
||||
0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x0F, 0xFC, 0xFF, 0x03, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xE0, 0x0F, 0xF0, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x0F, 0x80, 0xFF,
|
||||
0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x0F, 0x00, 0xFE, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xE0, 0x0F, 0x00, 0xF8, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x0F, 0x00, 0xE0, 0xFF, 0x03,
|
||||
0x00, 0x00, 0x00, 0x00, 0xE0, 0x0F, 0x00, 0x80, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x0F,
|
||||
0x00, 0x00, 0xFE, 0x1F, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x0F, 0x00, 0x00, 0xF8, 0x3F, 0x00, 0x00,
|
||||
0x00, 0x00, 0xE0, 0x0F, 0x00, 0x00, 0xF0, 0x7F, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x0F, 0x00, 0x00,
|
||||
0xC0, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x0F, 0x00, 0x00, 0x80, 0xFF, 0x00, 0x00, 0x00, 0x00,
|
||||
0xE0, 0x0F, 0x00, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x0F, 0x00, 0x00, 0x00, 0xFC,
|
||||
0x00, 0x00, 0x00, 0x00, 0xE0, 0x0F, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x07,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
|
||||
};
|
@ -0,0 +1,9 @@
|
||||
#include <avr/pgmspace.h>
|
||||
|
||||
#ifndef CAR_H
|
||||
|
||||
#define CAR_H
|
||||
|
||||
extern const unsigned char car[];
|
||||
|
||||
#endif
|
@ -0,0 +1,23 @@
|
||||
#include <TVout.h>
|
||||
#include "car.h"
|
||||
|
||||
|
||||
TVout TV;
|
||||
int val=0;
|
||||
|
||||
void setup() {
|
||||
// put your setup code here, to run once:
|
||||
TV.begin(PAL);
|
||||
Serial.begin(9600);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// put your main code here, to run repeatedly:
|
||||
//TV.clear_screen();
|
||||
int val_2=0;
|
||||
val=analogRead(A0);
|
||||
val_2=analogRead(A1);
|
||||
Serial.println(val_2);
|
||||
TV.bitmap(val,val_2/30,car);
|
||||
delay(60);
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
#include "car.h"
|
||||
|
||||
PROGMEM const unsigned char car[] = {
|
||||
// size is 96 x 96
|
||||
96,96,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x0F, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0xFE, 0xFF, 0x07,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0x80, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0xC0, 0x07, 0x00, 0x00, 0x00, 0xF0, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x07, 0x00,
|
||||
0x00, 0x00, 0x80, 0xFF, 0x03, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x03, 0x00, 0x00, 0x00, 0x00, 0xFE,
|
||||
0x07, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x1F, 0x00, 0x00, 0x00,
|
||||
0x00, 0xF8, 0x01, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x7F, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x00, 0xFF,
|
||||
0xFF, 0x01, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, 0xFF, 0xFF, 0x7F, 0x00, 0x00,
|
||||
0xFE, 0x03, 0x00, 0x00, 0x80, 0x3F, 0x80, 0xFF, 0xFF, 0xFF, 0x07, 0x00, 0xF8, 0x07, 0x00, 0x00,
|
||||
0xE0, 0x1F, 0xC0, 0xFF, 0xFF, 0xFF, 0x3F, 0x00, 0xF0, 0x0F, 0x00, 0x00, 0xFC, 0x0F, 0xC0, 0x07,
|
||||
0xC0, 0xFF, 0xFF, 0x01, 0xC0, 0x1F, 0x00, 0x00, 0xFF, 0x07, 0xE0, 0x03, 0x00, 0xE0, 0xFF, 0x07,
|
||||
0x80, 0x3F, 0x00, 0x00, 0xFF, 0x01, 0xF0, 0x03, 0x00, 0x00, 0xFE, 0x1F, 0x00, 0x7E, 0x00, 0x00,
|
||||
0x7F, 0x00, 0xF8, 0x01, 0x00, 0x00, 0xF0, 0x3F, 0x00, 0xFC, 0x01, 0x00, 0x1F, 0x00, 0xFC, 0x00,
|
||||
0x00, 0x00, 0xC0, 0xFF, 0x00, 0xF8, 0x01, 0x00, 0x1F, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00, 0xFF,
|
||||
0x01, 0xF0, 0x03, 0x00, 0x1F, 0x80, 0x3F, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x07, 0xE0, 0x07, 0x00,
|
||||
0x1F, 0xC0, 0x1F, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x0F, 0xC0, 0x0F, 0x00, 0x1F, 0xF0, 0x0F, 0x00,
|
||||
0x00, 0x00, 0x00, 0xC0, 0x1F, 0x80, 0x1F, 0x00, 0x1F, 0xF0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x80,
|
||||
0x3F, 0x00, 0x3F, 0x00, 0x1F, 0xF0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x00, 0x7E, 0x00,
|
||||
0x1F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x01, 0x7C, 0x00, 0x1F, 0xF0, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xF8, 0x03, 0xFC, 0x00, 0x1F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xF0, 0x03, 0xF8, 0x01, 0x1F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x07, 0xF0, 0x01,
|
||||
0x1F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x0F, 0xE0, 0x03, 0x1F, 0xF0, 0x00, 0x00,
|
||||
0xE0, 0x00, 0x00, 0x00, 0x80, 0x1F, 0xE0, 0x03, 0x1F, 0xF0, 0x00, 0x00, 0xFC, 0x07, 0x00, 0x00,
|
||||
0x00, 0x3F, 0xC0, 0x07, 0x1F, 0xF0, 0x00, 0x00, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x3E, 0xC0, 0x0F,
|
||||
0x1F, 0xF0, 0x00, 0x80, 0xFF, 0x3F, 0x00, 0x00, 0x00, 0x7C, 0x80, 0x0F, 0x1F, 0xF0, 0x00, 0xC0,
|
||||
0xFF, 0x7F, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x1F, 0x1F, 0xF0, 0x00, 0xC0, 0x0F, 0xFC, 0x00, 0x00,
|
||||
0x00, 0xF8, 0x00, 0x1F, 0x1F, 0xF0, 0x00, 0xE0, 0x07, 0xF8, 0x00, 0x00, 0x00, 0xF0, 0x01, 0x1E,
|
||||
0x1F, 0xF0, 0x00, 0xE0, 0x03, 0xF0, 0x01, 0x00, 0x00, 0xF0, 0x01, 0x3E, 0x1F, 0xF0, 0x00, 0xF0,
|
||||
0x01, 0xF0, 0x01, 0x00, 0x00, 0xE0, 0x03, 0x3C, 0x1F, 0xF0, 0x00, 0xF0, 0x01, 0xE0, 0xFF, 0x07,
|
||||
0x00, 0xC0, 0x07, 0x7C, 0x1F, 0xF0, 0x00, 0xF0, 0x01, 0xE0, 0xFF, 0x07, 0x00, 0xC0, 0x07, 0x78,
|
||||
0x1F, 0xF0, 0x00, 0xF0, 0x01, 0xE0, 0xFF, 0x07, 0x00, 0xC0, 0x07, 0x78, 0x1F, 0xF0, 0x00, 0xF0,
|
||||
0x01, 0xE0, 0xFF, 0x07, 0x00, 0xC0, 0x07, 0x7C, 0x1F, 0xF0, 0x00, 0xF0, 0x01, 0xF0, 0x01, 0x00,
|
||||
0x00, 0xE0, 0x03, 0x3C, 0x1F, 0xF0, 0x00, 0xE0, 0x03, 0xF0, 0x01, 0x00, 0x00, 0xF0, 0x01, 0x3E,
|
||||
0x1F, 0xF0, 0x00, 0xE0, 0x07, 0xF8, 0x00, 0x00, 0x00, 0xF0, 0x01, 0x1E, 0x1F, 0xF0, 0x00, 0xC0,
|
||||
0x0F, 0xFC, 0x00, 0x00, 0x00, 0xF8, 0x00, 0x1F, 0x1F, 0xF0, 0x00, 0xC0, 0xFF, 0x7F, 0x00, 0x00,
|
||||
0x00, 0xFC, 0x00, 0x1F, 0x1F, 0xF0, 0x00, 0x80, 0xFF, 0x3F, 0x00, 0x00, 0x00, 0x7C, 0x80, 0x0F,
|
||||
0x1F, 0xF0, 0x00, 0x00, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x3E, 0xC0, 0x0F, 0x1F, 0xF0, 0x00, 0x00,
|
||||
0xFC, 0x07, 0x00, 0x00, 0x00, 0x3F, 0xC0, 0x07, 0x1F, 0xF0, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00,
|
||||
0x80, 0x1F, 0xE0, 0x03, 0x1F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x0F, 0xE0, 0x03,
|
||||
0x1F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x07, 0xF0, 0x01, 0x1F, 0xF0, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xF0, 0x03, 0xF8, 0x01, 0x1F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xF8, 0x03, 0xFC, 0x00, 0x1F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x01, 0x7C, 0x00,
|
||||
0x1F, 0xF0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x00, 0x7E, 0x00, 0x1F, 0xF0, 0x07, 0x00,
|
||||
0x00, 0x00, 0x00, 0x80, 0x3F, 0x00, 0x3F, 0x00, 0x1F, 0xF0, 0x0F, 0x00, 0x00, 0x00, 0x00, 0xC0,
|
||||
0x1F, 0x80, 0x1F, 0x00, 0x1F, 0xC0, 0x1F, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x0F, 0xC0, 0x0F, 0x00,
|
||||
0x1F, 0x80, 0x3F, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x07, 0xE0, 0x07, 0x00, 0x1F, 0x00, 0x7E, 0x00,
|
||||
0x00, 0x00, 0x00, 0xFF, 0x01, 0xF0, 0x03, 0x00, 0x1F, 0x00, 0xFC, 0x00, 0x00, 0x00, 0xC0, 0xFF,
|
||||
0x00, 0xF8, 0x03, 0x00, 0x7F, 0x00, 0xF8, 0x01, 0x00, 0x00, 0xF0, 0x3F, 0x00, 0xFC, 0x01, 0x00,
|
||||
0xFF, 0x01, 0xF0, 0x03, 0x00, 0x00, 0xFE, 0x1F, 0x00, 0x7E, 0x00, 0x00, 0xFF, 0x07, 0xE0, 0x03,
|
||||
0x00, 0xE0, 0xFF, 0x07, 0x80, 0x3F, 0x00, 0x00, 0xFC, 0x0F, 0xE0, 0x07, 0xC0, 0xFF, 0xFF, 0x01,
|
||||
0xC0, 0x1F, 0x00, 0x00, 0xE0, 0x1F, 0xC0, 0xFF, 0xFF, 0xFF, 0x3F, 0x00, 0xF0, 0x0F, 0x00, 0x00,
|
||||
0x80, 0x3F, 0x80, 0xFF, 0xFF, 0xFF, 0x07, 0x00, 0xF8, 0x07, 0x00, 0x00, 0x00, 0x7F, 0x00, 0xFF,
|
||||
0xFF, 0x7F, 0x00, 0x00, 0xFE, 0x03, 0x00, 0x00, 0x00, 0xFC, 0x00, 0xFF, 0xFF, 0x01, 0x00, 0x00,
|
||||
0xFF, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x01, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x7F, 0x00, 0x00, 0x00,
|
||||
0x00, 0xF0, 0x03, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x1F, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x03, 0x00,
|
||||
0x00, 0x00, 0x00, 0xFE, 0x07, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0x00, 0x80, 0xFF,
|
||||
0x03, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x07, 0x00, 0x00, 0x00, 0xF0, 0xFF, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x80, 0x0F, 0x00, 0x00, 0x80, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x0F, 0x00,
|
||||
0x00, 0xFE, 0xFF, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF,
|
||||
0xFF, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
@ -0,0 +1,9 @@
|
||||
#include <avr/pgmspace.h>
|
||||
|
||||
#ifndef CAR_H
|
||||
|
||||
#define CAR_H
|
||||
|
||||
extern const unsigned char car[];
|
||||
|
||||
#endif
|
@ -0,0 +1,62 @@
|
||||
#include <TVout.h>
|
||||
#include <fontALL.h>
|
||||
#include "car.h"
|
||||
|
||||
TVout TV;
|
||||
unsigned char x,y,z,pixel_num,d_num;
|
||||
void setup() {
|
||||
x=0;
|
||||
y=0;
|
||||
z=0;
|
||||
pixel_num=0;
|
||||
d_num=0;
|
||||
Serial.begin(9600);
|
||||
TV.begin(PAL); //for devices with only 1k sram(m168) use TV.begin(_NTSC,128,56)
|
||||
TV.select_font(font6x8);
|
||||
Serial.println(TV.vres());
|
||||
Serial.println(TV.hres());
|
||||
|
||||
}
|
||||
|
||||
void loop() {
|
||||
TV.clear_screen();
|
||||
pixel_num=0;
|
||||
d_num=0;
|
||||
for(x=0;x<TV.hres();x++){
|
||||
z=random(TV.vres());
|
||||
if(analogRead(A1)<340){
|
||||
pixel_num=1;
|
||||
d_num=1000;
|
||||
}
|
||||
if(analogRead(A1)>340 && analogRead(A1)<680){
|
||||
pixel_num=2;
|
||||
d_num=400;
|
||||
//TV.clear_screen();
|
||||
}
|
||||
if(analogRead(A1)>680){
|
||||
pixel_num=4;
|
||||
d_num=0;
|
||||
}
|
||||
for(y=0;y<TV.vres();y++){
|
||||
if(analogRead(A0)<205){
|
||||
TV.set_pixel(x+random(TV.hres()/12),random(z,TV.vres()/4-z),pixel_num);
|
||||
}
|
||||
if(analogRead(A0)>205 && analogRead(A0)<410){
|
||||
TV.set_pixel(x+random(TV.hres()/10),random(z,TV.vres()/2.3-z),pixel_num);
|
||||
}
|
||||
if(analogRead(A0)>410 && analogRead(A0)<615){
|
||||
TV.set_pixel(x+random(TV.hres()/8),random(z,TV.vres()/2-z),pixel_num);
|
||||
}
|
||||
if(analogRead(A0)>615 && analogRead(A0)<820){
|
||||
TV.set_pixel(x+random(TV.hres()/6),random(z,TV.vres()/1.2-z),pixel_num);
|
||||
TV.bitmap(analogRead(A1),0,car);
|
||||
}
|
||||
if(analogRead(A0)>820){
|
||||
TV.set_pixel(x+random(TV.hres()/4),random(z,TV.vres()-z),pixel_num);
|
||||
}
|
||||
//TV.set_pixel(x+random(50),y+random(y,y*5),analogRead(A0)/10);
|
||||
//TV.delay(1000);
|
||||
}
|
||||
TV.delay(d_num);
|
||||
}
|
||||
}
|
@ -0,0 +1,112 @@
|
||||
/*
|
||||
* good old starfield - PASTIS 51 EDITION
|
||||
*
|
||||
* See starfield25 for context and more comments, otherwise it may not make much
|
||||
* sense...
|
||||
*
|
||||
* So basically the trick used to get more stars here, is not to free memory,
|
||||
* because that's not possible, but instead it's to make the stars use less memory.
|
||||
* To do that we change the type from float (4 bytes) to int (2 bytes).
|
||||
* The tradeoff is of course that now we have integers and not floating point numbers,
|
||||
* and that prevents us to have any meaningful results when we calculate vector related
|
||||
* stuff. But there's a workaround to this!
|
||||
* The workaround is very simple, we use int as floats without floating points, which
|
||||
* means that everytime we read from the array we convert the int to float and divide
|
||||
* it by an arbitrary precision value (here we use 100), and when we want to store a
|
||||
* float we multiply it by the same precision value and convert to int.
|
||||
* We loose in accuray, but that does not matter here at all.
|
||||
*
|
||||
* ex: we want to store 12,345678
|
||||
* 12,3456 * 100 = 1234,56
|
||||
* int(1234,56) = 1234
|
||||
* and converted back
|
||||
* float(1234 / 100) = 12,34
|
||||
* in the process with this trick we lost 0,005678 (who cares?)
|
||||
*
|
||||
* Note: most of the changes are in new_star(). There are some minor changes elsewhere,
|
||||
* mostly to try optimise things cheaply, ignore.
|
||||
*/
|
||||
#include <TVout.h>
|
||||
|
||||
TVout TV;
|
||||
|
||||
#define STARS 51
|
||||
|
||||
int x[STARS];
|
||||
int y[STARS];
|
||||
int vx[STARS];
|
||||
int vy[STARS];
|
||||
|
||||
void
|
||||
setup()
|
||||
{
|
||||
randomSeed(analogRead(6)); // effective?
|
||||
TV.begin(NTSC,120,96);
|
||||
new_stars();
|
||||
}
|
||||
|
||||
void
|
||||
new_star(uint8_t i)
|
||||
{
|
||||
uint8_t x_tmp, y_tmp;
|
||||
uint8_t ox = 60;
|
||||
uint8_t oy = 48;
|
||||
int dx, dy;
|
||||
float vl;
|
||||
|
||||
x_tmp = 30 + random(60);
|
||||
y_tmp = 24 + random(48);
|
||||
|
||||
dx = x_tmp - ox;
|
||||
dy = y_tmp - oy;
|
||||
|
||||
switch(dx)
|
||||
case 0: dx = 1; // CHEAT
|
||||
|
||||
vl = 1 / sqrt(dx*dx + dy*dy);
|
||||
vx[i] = int(dx * vl * 100);
|
||||
vy[i] = int(dy * vl * 100);
|
||||
|
||||
x[i] = x_tmp * 100;
|
||||
y[i] = y_tmp * 100;
|
||||
}
|
||||
|
||||
void
|
||||
new_stars()
|
||||
{
|
||||
for (uint8_t i = 0; i < STARS; i++)
|
||||
new_star(i);
|
||||
}
|
||||
|
||||
void
|
||||
update_stars()
|
||||
{
|
||||
for (uint8_t i = 0; i < 40; i++) {
|
||||
x[i] = x[i] + vx[i];
|
||||
y[i] = y[i] + vy[i];
|
||||
if (x[i] > 12000 || x[i] < 0 || y[i] < 0 || y[i] > 9600)
|
||||
new_star(i);
|
||||
}
|
||||
for (uint8_t i = 40; i < STARS; i++) {
|
||||
x[i] = x[i] + (vx[i] << 1);
|
||||
y[i] = y[i] + (vy[i] << 1);
|
||||
if (x[i] > 12000 || x[i] < 0 || y[i] < 0 || y[i] > 9600)
|
||||
new_star(i);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
draw_stars()
|
||||
{
|
||||
for (uint8_t i = 0; i < STARS; i++)
|
||||
TV.set_pixel(x[i]/100, y[i]/100, 1);
|
||||
}
|
||||
|
||||
void
|
||||
loop()
|
||||
{
|
||||
TV.delay_frame(1);
|
||||
update_stars();
|
||||
TV.clear_screen();
|
||||
draw_stars();
|
||||
}
|
Loading…
Reference in New Issue