# Pendulum wave using the LOL shield

I have had a lol shield laying around for quite a while now and never really used it beyond the example sketches. It’s a great little glowy shield, especially as I love anything involving leds.

So I decided to write up a quick sketch to make something interesting to light up my desk as I work. Being a physicist I decided on a pendulum wave. It’s a nice demonstration of simple harmonic motion and pretty hypnotic to watch. Here’s a nice youtube video of a real one in action: Pendulum Wave.

For my sketch, each vertical column of leds represents my mass on a spring, and each column will have a shorter string. This is simply modelled and a nice derivation is given here. So it was just a quick job of writing up a sketch and here we go! Enjoy the video (apologies for the poor quality). Here’s the sketch if you want to have a go:

#include <Charliplexing.h>

void setup() {
LedSign::Init(); //Initilizes the LoL Shield
}

int p = 0, Hled;
int N = 50; // N is the number of oscillations individual oscillations on the first pendulum until the whole wave repeats
int period = 20000; // each time step is an interger incremented each loop
double amplitude; // amplitude of each pendulum colomn

void loop() {

for(int x = 0; x < 14; x++){
for(int y = 0; y < 9; y++){
if(y == Hled[x]){
LedSign::Set(x,y,1);
}
else{
LedSign::Set(x,y,0);
}
}

for(int z = 0; z < 15; z++){
amplitude[z] = (4.5*(0.85+cos((2*3.141*(N+z))/(period)*p)))+0.5; // calculates the amplitude of each colomn
Hled[z] = int(amplitude[z]);
}
p++;

}
}
{"ft_lang_label":"__label__en","ft_lang_prob":0.83053106,"math_prob":0.98152727,"size":1573,"snap":"2023-14-2023-23","text_gpt3_token_len":434,"char_repetition_ratio":0.09623964,"word_repetition_ratio":0.0,"special_character_ratio":0.29688492,"punctuation_ratio":0.14076246,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9900618,"pos_list":[0,1,2],"im_url_duplicate_count":[null,10,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-03-26T05:19:07Z\",\"WARC-Record-ID\":\"<urn:uuid:1c9a3774-f90f-44db-bc98-9212a278baaf>\",\"Content-Length\":\"78963\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:bf5ad7b5-cc09-4fe9-b02b-725b21ad2683>\",\"WARC-Concurrent-To\":\"<urn:uuid:51cd59f0-0112-4b04-9b63-2778dd58d92c>\",\"WARC-IP-Address\":\"192.0.78.24\",\"WARC-Target-URI\":\"https://robinsterling.com/tag/lol-shield/\",\"WARC-Payload-Digest\":\"sha1:GSYB3KPY3E3R3IXAW5K7FNK27CLKKDW6\",\"WARC-Block-Digest\":\"sha1:OGNERB7TOPVELAL45WT3GYPGTHVVDSRI\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-14/CC-MAIN-2023-14_segments_1679296945433.92_warc_CC-MAIN-20230326044821-20230326074821-00271.warc.gz\"}"}