From 2ca81bdd4b23fd9e056ec0807a18120e603e4a09 Mon Sep 17 00:00:00 2001 From: Avital Date: Tue, 29 Oct 2019 14:37:00 +0100 Subject: [PATCH] test --- sketches/avital/28_10_3/28_10_3.ino | 43 +++++++++++++++ sketches/avital/28_10_4/28_10_4.ino | 60 +++++++++++++++++++++ sketches/avital/white-noise/white-noise.ino | 25 +++++++++ 3 files changed, 128 insertions(+) create mode 100644 sketches/avital/28_10_3/28_10_3.ino create mode 100644 sketches/avital/28_10_4/28_10_4.ino create mode 100644 sketches/avital/white-noise/white-noise.ino diff --git a/sketches/avital/28_10_3/28_10_3.ino b/sketches/avital/28_10_3/28_10_3.ino new file mode 100644 index 0000000..a75007a --- /dev/null +++ b/sketches/avital/28_10_3/28_10_3.ino @@ -0,0 +1,43 @@ +#include +#include + + +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;x205 && 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); + } + } +} diff --git a/sketches/avital/28_10_4/28_10_4.ino b/sketches/avital/28_10_4/28_10_4.ino new file mode 100644 index 0000000..e184a56 --- /dev/null +++ b/sketches/avital/28_10_4/28_10_4.ino @@ -0,0 +1,60 @@ +#include +#include + + +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;x340 && analogRead(A1)<680){ + pixel_num=2; + d_num=400; + } + if(analogRead(A1)>680){ + pixel_num=4; + d_num=0; + } + for(y=0;y205 && 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); + } +} diff --git a/sketches/avital/white-noise/white-noise.ino b/sketches/avital/white-noise/white-noise.ino new file mode 100644 index 0000000..c30b386 --- /dev/null +++ b/sketches/avital/white-noise/white-noise.ino @@ -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)) +}