0

40 hertz flashing of NeoPixels
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

40 hertz flashing of NeoPixels

by JamesLaderoute on Thu Dec 15, 2016 7:15 pm

I recently read about some research being done in regards to Dementia and light therapy.
See Youtube video: https://www.youtube.com/watch?v=O_p4QWk ... 279.638467

Well, I took my Circuit Playground and wrote this program to make all the NeoPixels flash
at 40 Hz rate (which is the flashing rate mentioned in the video and article).


Code: Select all | TOGGLE FULL SIZE
/*
** The Massachusetts team found shining a strobe light into rodents' eyes encouraged protective cells
** to gobble up the harmful proteins that accumulate in the brain in this type of dementia.
** The perfect rate of flashes was 40 per second - a barely perceptible flicker, four times as fast
** as a disco strobe.
**
** https://www.youtube.com/watch?v=O_p4QWkE2Ls#t=279.638467
*/

//
// Flash the light 40 times per second means one flash every 25 milli-seconds
//

#include <Adafruit_CircuitPlayground.h>

#define HOW_BRIGHT 255 // 0-255, default setting would be 30
#define DELAY_OFF 10 // 10 ms
#define DELAY_ON 11  // 11 ms

void setup() {
  CircuitPlayground.begin();
  CircuitPlayground.setBrightness( HOW_BRIGHT );
}

void loop() {
      // OFF
      CircuitPlayground.clearPixels();   
      delay(DELAY_OFF);
   
      CircuitPlayground.setPixelColor(0, 255, 255, 255);
      CircuitPlayground.setPixelColor(9, 255, 255, 255);
      CircuitPlayground.setPixelColor(1, 255, 255, 255);
      CircuitPlayground.setPixelColor(8, 255, 255, 255);
      CircuitPlayground.setPixelColor(2, 255, 255, 255);
      CircuitPlayground.setPixelColor(7, 255, 255, 255);
      CircuitPlayground.setPixelColor(3, 255, 255, 255);
      CircuitPlayground.setPixelColor(6, 255, 255, 255);
      CircuitPlayground.setPixelColor(4, 255, 255, 255);
      CircuitPlayground.setPixelColor(5, 255, 255, 255);
   
      delay(DELAY_ON);
}

JamesLaderoute
 
Posts: 22
Joined: Wed Sep 14, 2016 10:38 pm

Re: 40 hertz flashing of NeoPixels

by dhalbert on Thu Dec 15, 2016 10:02 pm

I heard about this research on Radiolab: http://www.radiolab.org/story/bringing-gamma-back/. There are related links on the left side of that page.

dhalbert
 
Posts: 401
Joined: Tue Feb 17, 2015 6:18 pm

Re: 40 hertz flashing of NeoPixels

by adafruit_support_bill on Fri Dec 16, 2016 6:49 am

Interesting research. Maybe we should just develop a computer monitor with a pulsed backlight ;-)

adafruit_support_bill
 
Posts: 74337
Joined: Sat Feb 07, 2009 10:11 am

Re: 40 hertz flashing of NeoPixels

by SimonPG on Sat Aug 24, 2019 6:50 am

Great program by James Laderoute to generate 40 Hz flashing lights in circuit playground for alzheimer treatment. However as a new beginner I cannot get the program to run. I hope that somebody can help
I get an error message "a function definition(void loop) is not allowed here before "{" token ".(please see his program)
I assume I am making an elementary mistake here. Hope someone can help me with this ?
thanks

SimonPG
 
Posts: 5
Joined: Sat Aug 24, 2019 6:27 am

Re: 40 hertz flashing of NeoPixels

by adafruit_support_bill on Sat Aug 24, 2019 7:22 am

The program looks correct and I am able to compile it here without problems. Maybe something got corrupted as you copied it to the IDE. Try a fresh copy.

adafruit_support_bill
 
Posts: 74337
Joined: Sat Feb 07, 2009 10:11 am

Re: 40 hertz flashing of NeoPixels

by SimonPG on Sat Aug 24, 2019 7:57 am

Thanks for your reply !
So if I run
"
Code: Select all | TOGGLE FULL SIZE
 //
// Flash the light 40 times per second means one flash every 25 milli-seconds
//

#include <Adafruit_CircuitPlayground.h>

#define HOW_BRIGHT 255 // 0-255, default setting would be 30
#define DELAY_OFF 10 // 10 ms
#define DELAY_ON 11  // 11 ms
void loop() { CircuitPlayground.begin();
  CircuitPlayground.setBrightness( HOW_BRIGHT );
}

 {void loop()
      // OFF
      CircuitPlayground.clearPixels();   
      delay(DELAY_OFF);
   
      CircuitPlayground.setPixelColor(0, 255, 255, 255);
      CircuitPlayground.setPixelColor(9, 255, 255, 255);
      CircuitPlayground.setPixelColor(1, 255, 255, 255);
      CircuitPlayground.setPixelColor(8, 255, 255, 255);
      CircuitPlayground.setPixelColor(2, 255, 255, 255);
      CircuitPlayground.setPixelColor(7, 255, 255, 255);
      CircuitPlayground.setPixelColor(3, 255, 255, 255);
      CircuitPlayground.setPixelColor(6, 255, 255, 255);
      CircuitPlayground.setPixelColor(4, 255, 255, 255);
      CircuitPlayground.setPixelColor(5, 255, 255, 255);
   
      delay(DELAY_ON);
 

}
"
It should work as a loop? But it doesnt and I get the same error message as before?
Last edited by adafruit_support_bill on Sat Aug 24, 2019 10:10 am, edited 1 time in total.
Reason: Please use [code] tags when posting code to the forums.

SimonPG
 
Posts: 5
Joined: Sat Aug 24, 2019 6:27 am

Re: 40 hertz flashing of NeoPixels

by SimonPG on Sat Aug 24, 2019 8:14 am

Sorry the error message is a little different this time
"expected unqualified-id before '{' token

SimonPG
 
Posts: 5
Joined: Sat Aug 24, 2019 6:27 am

Re: 40 hertz flashing of NeoPixels

by adafruit_support_bill on Sat Aug 24, 2019 10:13 am

Code: Select all | TOGGLE FULL SIZE
 {void loop()


You have an '{' before the "void loop()". That is not in the original code.

adafruit_support_bill
 
Posts: 74337
Joined: Sat Feb 07, 2009 10:11 am

Re: 40 hertz flashing of NeoPixels

by SimonPG on Sun Aug 25, 2019 9:29 am

This below in quotes(") is what I ran now- I copied the code directly from the forum message but the error was "expected initializer before 'CircuitPlayground'". Thanks for your patience with a new coder.

"
Code: Select all | TOGGLE FULL SIZE
void loop() {
  /* Flashinglights
https://forums.adafruit.com/viewtopic.php?f=25&p=541537

** The Massachusetts team found shining a strobe light into rodents' eyes encouraged protective cells
** to gobble up the harmful proteins that accumulate in the brain in this type of dementia.
** The perfect rate of flashes was 40 per second - a barely perceptible flicker, four times as fast
** as a disco strobe.
**
** https://www.youtube.com/watch?v=O_p4QWkE2Ls#t=279.638467
*/

//
// Flash the light 40 times per second means one flash every 25 milli-seconds
//

#include <Adafruit_CircuitPlayground.h>

#define HOW_BRIGHT 255 // 0-255, default setting would be 30
#define DELAY_OFF 10 // 10 ms
#define DELAY_ON 11  // 11 ms

 {
  CircuitPlayground.begin();
  CircuitPlayground.setBrightness( HOW_BRIGHT );
}

 {void loop()
      // OFF
      CircuitPlayground.clearPixels();   
      delay(DELAY_OFF);
   
      CircuitPlayground.setPixelColor(0, 255, 255, 255);
      CircuitPlayground.setPixelColor(9, 255, 255, 255);
      CircuitPlayground.setPixelColor(1, 255, 255, 255);
      CircuitPlayground.setPixelColor(8, 255, 255, 255);
      CircuitPlayground.setPixelColor(2, 255, 255, 255);
      CircuitPlayground.setPixelColor(7, 255, 255, 255);
      CircuitPlayground.setPixelColor(3, 255, 255, 255);
      CircuitPlayground.setPixelColor(6, 255, 255, 255);
      CircuitPlayground.setPixelColor(4, 255, 255, 255);
      CircuitPlayground.setPixelColor(5, 255, 255, 255);
   
      delay(DELAY_ON);
}


}
"
Last edited by adafruit_support_bill on Sun Aug 25, 2019 9:47 am, edited 1 time in total.
Reason: Please use [code] tags when posting code to the forums.

SimonPG
 
Posts: 5
Joined: Sat Aug 24, 2019 6:27 am

Re: 40 hertz flashing of NeoPixels

by adafruit_support_bill on Sun Aug 25, 2019 9:53 am

This below in quotes(") is what I ran now

Please use [code] tags when posting code to the forums. Click on the [code] button and paste your code between the tags.

I copied the code directly from the forum message

Take a close look at the first 4 lines of what you have there. That is not in the forum message - or in the original code from the tutorial.

adafruit_support_bill
 
Posts: 74337
Joined: Sat Feb 07, 2009 10:11 am

Re: 40 hertz flashing of NeoPixels

by SimonPG on Mon Sep 02, 2019 7:50 am

Great ! Thank you. Working perfectly now !

SimonPG
 
Posts: 5
Joined: Sat Aug 24, 2019 6:27 am

Please be positive and constructive with your questions and comments.