sinus wave test

This commit is contained in:
interfisch 2023-02-13 19:58:45 +01:00
parent aee0352422
commit 17f0de5f77
3 changed files with 24 additions and 3 deletions

View File

@ -56,6 +56,7 @@ public:
void shuffleOrder(uint8_t iterations); void shuffleOrder(uint8_t iterations);
void setBuffer_solid(bool set); void setBuffer_solid(bool set);
void setBufferColumn(uint8_t _colnum, uint16_t _rowdata);
void setBuffer_random(uint8_t randomness); void setBuffer_random(uint8_t randomness);
void loop_testDots(); void loop_testDots();

View File

@ -44,7 +44,17 @@ void Image::setBuffer_solid(bool set)
} }
flag_updating=true; //make update run flag_updating=true; //make update run
}
void Image::setBufferColumn(uint8_t _colnum, uint16_t _rowdata)
{
if (_colnum>=COLUMNS) {
Serial.println("colnum too high");
}else{
backBuffer[_colnum]=_rowdata; //all white
flag_updating=true; //make update run
}
} }
void Image::setBuffer_random(uint8_t randomness) void Image::setBuffer_random(uint8_t randomness)

View File

@ -27,16 +27,26 @@ void loop() {
static unsigned long last_change=0; static unsigned long last_change=0;
static bool color=0; static bool color=0;
if (loopmillis-last_change >= 5000) if (loopmillis-last_change >= 1000)
{ {
//Serial.print("Change to Solid color ="); Serial.println(color); //Serial.print("Change to Solid color ="); Serial.println(color);
//flip.setBuffer_solid(color); //flip.setBuffer_solid(color);
//color=1-color; //color=1-color;
uint8_t _randomvalue=random(64); /*
uint8_t _randomvalue=random(128);
Serial.print("set buffer random. "); Serial.print("set buffer random. ");
Serial.println(_randomvalue); Serial.println(_randomvalue);
flip.setBuffer_random(_randomvalue); flip.setBuffer_random(_randomvalue);
*/
for (uint8_t _x=0;_x<COLUMNS;_x++) {
uint8_t _y=(sin( loopmillis/100000.0 + _x/5.0 )/2+0.5)*15+0.5;
uint16_t _row=pow(2, _y);
flip.setBufferColumn(_x,_row);
}
last_change=loopmillis; last_change=loopmillis;
} }