master
Avital 5 years ago
parent 8f306b1bda
commit 2ca81bdd4b

@ -0,0 +1,43 @@
#include <TVout.h>
#include <fontALL.h>
TVout TV;
unsigned char x,y,z;
void setup() {
x=0;
y=0;
z=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();
for(x=0;x<TV.hres();x++){
z=random(TV.vres());
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),1);
}
if(analogRead(A0)>205 && analogRead(A0)<410){
TV.set_pixel(x+random(TV.hres()/10),random(z,TV.vres()/2.3-z),1);
}
if(analogRead(A0)>410 && analogRead(A0)<615){
TV.set_pixel(x+random(TV.hres()/8),random(z,TV.vres()/2-z),1);
}
if(analogRead(A0)>615 && analogRead(A0)<820){
TV.set_pixel(x+random(TV.hres()/6),random(z,TV.vres()/1.2-z),2);
}
if(analogRead(A0)>820){
TV.set_pixel(x+random(TV.hres()/4),random(z,TV.vres()-z),3);
}
//TV.set_pixel(x+random(50),y+random(y,y*5),analogRead(A0)/10);
//TV.delay(1000);
}
}
}

@ -0,0 +1,60 @@
#include <TVout.h>
#include <fontALL.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;
}
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);
}
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,25 @@
/*
*
* White Noise Generator (simple)
*
*/
long randNumber; //variable to store random number
int pwmPin = 11; //define output pin, Meergranen output pin is 11
void setup() {
// if analog input pin 5 is unconnected, random analog
// noise will cause the call to randomSeed() to generate
// different seed numbers each time the sketch runs.
// randomSeed() will then shuffle the random function.
randomSeed(analogRead(5));
pinMode(pwmPin,OUTPUT); //set pwmPin to output mode (otherwise the built-in pulldown resistor sets it as input, aka you wont hear anything)
}
void loop() {
randNumber = random(10, 100); //generate random number between 10 and 100
digitalWrite(pwmPin, LOW); //set output pin to LOW (0v)
delayMicroseconds(randNumber);//wait for randomNumber (10-100 Mircroseconds (0.00001-0.0001 seconds))
digitalWrite(pwmPin, HIGH); //set output pin to HIGH (5v)
delayMicroseconds(randNumber); //wait for randomNumber (10-100 Mircroseconds (0.00001-0.0001 seconds))
}
Loading…
Cancel
Save