Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "LedControl.h"
- LedControl lc=LedControl(12,11,10,1);
- const uint64_t fpsSHOW[] = {
- 0xffffffffffffffff,
- 0x0000000000000000
- };
- void displayImage(uint64_t image) {
- for (int i = 0; i < 8; i++) {
- byte row = (image >> i * 8)& 0xFF;
- for (int j = 0; j < 8; j++) {
- lc.setLed(0, i, j, bitRead(row, j));
- }
- }
- // lc.setRow(0,2,B00001111);
- }
- unsigned long interval[100];
- bool whichImg;
- unsigned long prevtime = 0;
- void setup() {
- // put your setup code here, to run once:
- lc.shutdown(0,false);
- /* Set the brightness to a medium values */
- lc.setIntensity(0,8);
- /* and clear the display */
- lc.clearDisplay(0);
- whichImg = true;
- for(int i = 0; i< 100; i++)
- {
- interval[i] = long(1000/(float(i)*2.0));
- }
- }
- void loop() {
- unsigned long currenttime = millis();
- unsigned long diff = currenttime - prevtime;
- if(diff > interval[60]){
- prevtime = currenttime;
- whichImg = !whichImg;
- // displayImage(fpsSHOW[whichImg]);
- if(whichImg)
- {
- for(int i = 0; i < 8; i++){
- lc.setRow(0,i,B11111111);
- }
- }else{
- for(int i = 0; i < 8; i++){
- lc.setRow(0,i,B00000000);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement