[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-detail-147197-en":3,"doc-seo-147197-105":30,"detail-sidebar-cat-0-en-105":91},{"code":4,"msg":5,"data":6},0,"success",{"doc_id":7,"user_id":8,"nickname":9,"user_avatar":10,"doc_module":4,"category_id":11,"category_name":12,"doc_title":13,"doc_description":14,"doc_content":15,"file_id":16,"file_url":17,"file_type":18,"file_size":19,"view_count":4,"is_deleted":4,"is_public":20,"is_downloadable":20,"audit_status":20,"page_count":21,"language":22,"language_code":23,"site_id":24,"html_lang":23,"table_of_contents":25,"faqs":26,"seo_title":27,"seo_description":14,"update_tm":28,"read_time":29},147197,137451211410,"\tCallum ","https://ap-avatar.wpscdn.com/avatar/2000bb0a9246f588df?x-image-process=image/resize,m_fixed,w_180,h_180&k=1786362646172706240",6,"Technology","Pacman+Ghost+Code - LED Matrix Ghost Animation with Temperature Sensor","LED matrix animation sketch combining a ghost visual (red and aqua/cold-temperature color modes) with a temperature sensor check using Adafruit_BME280. The program initializes a strip of 71 NeoPixel LEDs via FastLED, sets brightness, and reads a pushbutton input. It defines a reset routine to turn all LEDs black, then drives frame-by-frame LED patterns for the ghost body, eyes, and feet using timed FastLED.show calls.","// Pacman/Ghost LED Matrix  \n// Monserrath Velasco  \n// Santiago Guerra  \n// Import of LED strip library  \n\\#include \u003CFastLED. h>  \n//Import of temperature sensor library  \n\\#include \u003CAdafruit_Sensor. h>  \n\\#include \u003CAdafruit_BME280 . h>  \n//setting up the LED strip  \n\\#define NUM_LEDS 71  \n\\#define DATA_PIN 7  \n//setting up the LED strip's brightness  \n\\#define BRIGHTNESS 100  \nCRGB leds[NUM_LEDS]; //setting up the block of memory used for LED data  \nint buttonPin = 4; //assigning the push button pin int buttonState = 0; // variable for reading the pushbutton status int ledflag = 0; // LED status flag  \nint sensor = A4; //assigning the push button pin  \nAdafruit_BME280 bme; //creating an instance of the temperature sensor  \nvoid setup() {  \nFastLED.addLeds\u003CNEOPIXEL, DATA_PIN>(leds, NUM_LEDS); //defining the array of LEDs FastLED.setBrightness(BRIGHTNESS); //setting the LEDs brightness  \nSerial. begin(9600); //the bound rate for serial monitor  \npinMode(buttonPin, INPUT); // defining pushbutton as an input  \nif (!bme. begin(0x76)) {  \nSerial. println(\"Could not find temperature\");  \nwhile(1);}  \n}  \n//Function to reset (turn off) all the LED strip void reset() {  \nfor (int dot = 0; dot \u003C NUM_LEDS; dot++) { leds[dot] = CRGB::Black; //turn off each LED  \n[FastLED.show](FastLED.show) ();  \ndelay(20);  \n}  \n}  \n//Function to display the ghost LED animation void ghost_loop() {  \n//creating the initial \"body\"for (int dot = 0; dot \u003C 6; dot++) { leds[dot] = CRGB::Red;  \n[FastLED.show](FastLED.show) ();  \ndelay(200);}  \ndelay(200);  \nfor (int dot = 7; dot \u003C 11; dot++) { leds[dot] = CRGB::Red;  \n[FastLED.show](FastLED.show) ();  \ndelay(200);}  \ndelay(200);  \n//creating the ghost's eyes leds[11] = CRGB::Blue;  \n[FastLED.show](FastLED.show) ();  \ndelay(200);  \nleds[12] = CRGB::White;  \n[FastLED.show](FastLED.show) ();  \ndelay(200);  \nleds[13] = CRGB::Red;  \n[FastLED.show](FastLED.show) ();  \ndelay(200);  \nleds[14] = CRGB::Red;  \n[FastLED.show](FastLED.show) ();  \ndelay(200);  \nleds[15] = CRGB::White;  \n[FastLED.show](FastLED.show) ();  \ndelay(200);  \nleds[16] = CRGB::White;  \n[FastLED.show](FastLED.show) ();  \ndelay(200);  \n//continuing with the ghost's \"body\"for (int dot = 17; dot \u003C 22 ; dot++) { leds[dot] = CRGB::Red;  \n[FastLED.show](FastLED.show) ();  \ndelay(200);}  \ndelay(200);  \n//continuing with the ghost's \"body\"for (int dot = 23; dot \u003C 40 ; dot++) { leds[dot] = CRGB::Red;  \n[FastLED.show](FastLED.show) ();  \ndelay(200);}  \ndelay(200);  \n//continuing with the ghost's \"body\"for (int dot = 41; dot \u003C 45 ; dot++) { leds[dot] = CRGB::Red;  \n[FastLED.show](FastLED.show) ();  \ndelay(200);}  \ndelay(200);  \n//continuing with the ghost's eyes leds[45] = CRGB::Blue;  \n[FastLED.show](FastLED.show) ();  \ndelay(200);  \nleds[46] = CRGB::White;  \n[FastLED.show](FastLED.show) ();  \ndelay(200);  \nleds[47] = CRGB::Red;  \n[FastLED.show](FastLED.show) ();  \ndelay(200);  \nleds[48] = CRGB::Red;  \n[FastLED.show](FastLED.show) ();  \ndelay(200);  \nleds[49] = CRGB::Red;  \n[FastLED.show](FastLED.show) ();  \ndelay(200);  \nleds[50] = CRGB::White;  \n[FastLED.show](FastLED.show)();  \ndelay(200);  \nleds[51] = CRGB::White;  \n[FastLED.show](FastLED.show) ();  \ndelay(200);  \n//finishing with the ghost's \"body\"for (int dot = 52; dot \u003C 57 ; dot++) { leds[dot] = CRGB::Red;  \n[FastLED.show](FastLED.show) ();  \ndelay(200);}  \ndelay(200);  \n//finishing with the ghost's \"body\"for (int dot = 58; dot \u003C NUM_LEDS ; dot++) { leds[dot] = CRGB::Red;  \n[FastLED.show](FastLED.show) ();  \ndelay(200);}  \ndelay(200);  \n//moving ghost's \"feet\" by alternating colors for (int i = 0; i \u003C 5; i++) {  \nleds[6] = CRGB::Red;  \nleds[22] = CRGB::Red;  \nleds[40] = CRGB::Red;  \nleds[57] = CRGB::Red;  \n[FastLED.show](FastLED.show) ();  \nleds[5] = CRGB::Black;  \nleds[21] = CRGB::Black;  \nleds[39] = CRGB::Black;  \nleds[56] = CRGB::Black;  \nleds[70] = CRGB::Black;  \n[FastLED.show](FastLED.show) ();  \ndelay(200);  \nleds[6] = CRGB::Black;  \nleds[22] = CRGB::Black;  \nleds[40] = CRGB::Black;  \nleds[57] = ","cbCaiqFmZbnp4uNm","https://ap.wps.com/l/cbCaiqFmZbnp4uNm","pdf",60857,1,14,"English","en",105,"# Program Structure\n## Initialization and Setup\n## LED Control and Reset\n## Ghost Animation (Red)\n## Ghost Animation (Aqua / Cold Mode)","[{\"question\":\"How is the LED strip initialized and controlled in the sketch?\",\"answer\":\"FastLED.addLeds configures a 71-LED NeoPixel strip on DATA_PIN, and brightness is set with FastLED.setBrightness. LED colors are stored in a CRGB array and rendered using FastLED.show with delays.\"},{\"question\":\"What does the reset routine do?\",\"answer\":\"The reset routine loops through all NUM_LEDS and sets each LED to CRGB::Black, then updates the strip with FastLED.show and a short delay to clear the display.\"},{\"question\":\"How does the sketch switch the ghost appearance between warm and cold modes?\",\"answer\":\"It includes a BME280 temperature sensor setup and uses separate animation functions: one that renders the ghost in red tones and another that renders the ghost in aqua/blue tones for cold-temperature behavior.\"}]","Pacman+Ghost+Code - LED Matrix Ghost Animation with Temperature Sensor | PDF",1787760259,35,{"code":4,"msg":31,"data":32},"ok",{"site_id":24,"language":23,"slug":33,"title":13,"keywords":34,"description":14,"schema_data":35,"social_meta":86,"head_meta":88,"extra_data":90,"updated_unix":28},"pacmanghostcode-led-matrix-ghost-animation-with-temperature-sensor","",{"@graph":36,"@context":85},[37,54,68],{"@type":38,"itemListElement":39},"BreadcrumbList",[40,44,48,51],{"item":41,"name":42,"@type":43,"position":20},"https://docshare.wps.com","Home","ListItem",{"item":45,"name":46,"@type":43,"position":47},"https://docshare.wps.com/document/","Document",2,{"item":49,"name":12,"@type":43,"position":50},"https://docshare.wps.com/document/technology/",3,{"item":52,"name":13,"@type":43,"position":53},"https://docshare.wps.com/document/pacmanghostcode-led-matrix-ghost-animation-with-temperature-sensor/147197/",4,{"url":52,"name":13,"@type":55,"author":56,"headline":13,"publisher":58,"fileFormat":61,"inLanguage":23,"description":14,"dateModified":62,"datePublished":62,"encodingFormat":61,"isAccessibleForFree":63,"interactionStatistic":64},"DigitalDocument",{"name":9,"@type":57},"Person",{"url":41,"name":59,"@type":60},"DocShare","Organization","application/pdf","2026-08-26",true,{"@type":65,"interactionType":66,"userInteractionCount":4},"InteractionCounter",{"@type":67},"ViewAction",{"@type":69,"mainEntity":70},"FAQPage",[71,77,81],{"name":72,"@type":73,"acceptedAnswer":74},"How is the LED strip initialized and controlled in the sketch?","Question",{"text":75,"@type":76},"FastLED.addLeds configures a 71-LED NeoPixel strip on DATA_PIN, and brightness is set with FastLED.setBrightness. LED colors are stored in a CRGB array and rendered using FastLED.show with delays.","Answer",{"name":78,"@type":73,"acceptedAnswer":79},"What does the reset routine do?",{"text":80,"@type":76},"The reset routine loops through all NUM_LEDS and sets each LED to CRGB::Black, then updates the strip with FastLED.show and a short delay to clear the display.",{"name":82,"@type":73,"acceptedAnswer":83},"How does the sketch switch the ghost appearance between warm and cold modes?",{"text":84,"@type":76},"It includes a BME280 temperature sensor setup and uses separate animation functions: one that renders the ghost in red tones and another that renders the ghost in aqua/blue tones for cold-temperature behavior.","https://schema.org",{"og:url":52,"og:type":87,"og:title":13,"og:site_name":59,"og:description":14},"article",{"robots":89,"canonical":52},"index,follow",{"doc_id":7,"site_id":24},{"code":4,"msg":5,"data":92},[93,97,101,105,110,113,118,123,128,131,135],{"id":20,"doc_module":4,"doc_module_name":46,"category_name":94,"show_sort_weight":95,"slug":96},"Story & Novel",90,"story-novel",{"id":47,"doc_module":4,"doc_module_name":46,"category_name":98,"show_sort_weight":99,"slug":100},"Literature",80,"literature",{"id":53,"doc_module":4,"doc_module_name":46,"category_name":102,"show_sort_weight":103,"slug":104},"Exam",70,"exam",{"id":106,"doc_module":4,"doc_module_name":46,"category_name":107,"show_sort_weight":108,"slug":109},5,"Comic",60,"comic",{"id":11,"doc_module":4,"doc_module_name":46,"category_name":12,"show_sort_weight":111,"slug":112},50,"technology",{"id":114,"doc_module":4,"doc_module_name":46,"category_name":115,"show_sort_weight":116,"slug":117},7,"Healthcare",40,"healthcare",{"id":119,"doc_module":4,"doc_module_name":46,"category_name":120,"show_sort_weight":121,"slug":122},8,"Research & Report",30,"research-report",{"id":124,"doc_module":4,"doc_module_name":46,"category_name":125,"show_sort_weight":126,"slug":127},9,"Religion & Spirituality",20,"religion-spirituality",{"id":126,"doc_module":4,"doc_module_name":46,"category_name":129,"show_sort_weight":126,"slug":130},"World Cup","world-cup",{"id":132,"doc_module":4,"doc_module_name":46,"category_name":133,"show_sort_weight":132,"slug":134},10,"Lifestyle","lifestyle",{"id":136,"doc_module":4,"doc_module_name":46,"category_name":137,"show_sort_weight":106,"slug":138},19,"General","general"]