Advertisement
pleasedontcode

Alloo rev_03

Nov 13th, 2023
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /********* Pleasedontcode.com **********
  2.  
  3.     Pleasedontcode thanks you for automatic code generation! Enjoy your code!
  4.  
  5.     - Terms and Conditions:
  6.     You have a non-exclusive, revocable, worldwide, royalty-free license
  7.     for personal and commercial use. Attribution is optional; modifications
  8.     are allowed, but you're responsible for code maintenance. We're not
  9.     liable for any loss or damage. For full terms,
  10.     please visit pleasedontcode.com/termsandconditions.
  11.  
  12.     - Project: Alloo
  13.     - Source Code compiled for: Arduino Uno
  14.     - Source Code created on: 2023-11-13 09:31:10
  15.     - Source Code generated by: SSS Shivansh
  16.  
  17. ********* Pleasedontcode.com **********/
  18. /****** DEFINITION OF LIBRARIES *****/
  19. #include <Arduino.h>
  20.  
  21. /****** SYSTEM REQUIREMENT 1 *****/
  22. /* Persistence of vision display which displays text */
  23. /* and I can change that text over WiFi via ESP8266 */
  24.  
  25. /****** FUNCTION PROTOTYPES *****/
  26. void setup(void);
  27. void loop(void);
  28. void displayText(const char* text);
  29.  
  30. /***** DEFINITION OF DIGITAL OUTPUT PINS *****/
  31. const uint8_t LED_PIN_D2 = 2;
  32. const uint8_t LED_PIN_D3 = 3;
  33. const uint8_t LED_PIN_D4 = 4;
  34. const uint8_t LED_PIN_D5 = 5;
  35. const uint8_t LED_PIN_D6 = 6;
  36.  
  37. void setup(void)
  38. {
  39.   // put your setup code here, to run once:
  40.   pinMode(LED_PIN_D2, OUTPUT);
  41.   pinMode(LED_PIN_D3, OUTPUT);
  42.   pinMode(LED_PIN_D4, OUTPUT);
  43.   pinMode(LED_PIN_D5, OUTPUT);
  44.   pinMode(LED_PIN_D6, OUTPUT);
  45.  
  46.   Serial.begin(9600);
  47.   Serial.println("Setup complete");
  48. }
  49.  
  50. void loop(void)
  51. {
  52.   // put your main code here, to run repeatedly:
  53.   // Example: Change the displayed text every 5 seconds
  54.   displayText("Hello");
  55.   delay(5000);
  56.   displayText("World");
  57.   delay(5000);
  58. }
  59.  
  60. void displayText(const char* text)
  61. {
  62.   // Code to control the persistence of vision display and update the displayed text
  63.   // Implement your display control logic here
  64.   // Example: Turn on LEDs based on the text pattern
  65.   if (strcmp(text, "Hello") == 0)
  66.   {
  67.     digitalWrite(LED_PIN_D2, HIGH);
  68.     digitalWrite(LED_PIN_D3, HIGH);
  69.     digitalWrite(LED_PIN_D4, LOW);
  70.     digitalWrite(LED_PIN_D5, LOW);
  71.     digitalWrite(LED_PIN_D6, HIGH);
  72.   }
  73.   else if (strcmp(text, "World") == 0)
  74.   {
  75.     digitalWrite(LED_PIN_D2, HIGH);
  76.     digitalWrite(LED_PIN_D3, LOW);
  77.     digitalWrite(LED_PIN_D4, HIGH);
  78.     digitalWrite(LED_PIN_D5, LOW);
  79.     digitalWrite(LED_PIN_D6, HIGH);
  80.   }
  81. }
  82.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement