daily_automated

This commit is contained in:
topicchi
2023-03-17 11:59:21 +00:00
parent 252ecca9cf
commit e2f276193e
4496 changed files with 1178007 additions and 0 deletions

View File

@@ -0,0 +1,54 @@
#include <SPI.h>
#include <Wire.h>
#include <MultiLCD.h>
LCD_ILI9341 lcd; /* for 2.2" SPI TFT module */
#define ANALOG_PIN A3
#define BUTTON_PIN 8
const PROGMEM uint8_t tick[16 *16 / 8] =
{0x00,0x80,0xC0,0xE0,0xC0,0x80,0x00,0x80,0xC0,0xE0,0xF0,0xF8,0xFC,0x78,0x30,0x00,0x00,0x01,0x03,0x07,0x0F,0x1F,0x1F,0x1F,0x0F,0x07,0x03,0x01,0x00,0x00,0x00,0x00};
const PROGMEM uint8_t cross[16 *16 / 8] =
{0x00,0x0C,0x1C,0x3C,0x78,0xF0,0xE0,0xC0,0xE0,0xF0,0x78,0x3C,0x1C,0x0C,0x00,0x00,0x00,0x30,0x38,0x3C,0x1E,0x0F,0x07,0x03,0x07,0x0F,0x1E,0x3C,0x38,0x30,0x00,0x00};
void setup() {
// set up LCD display
lcd.begin();
lcd.setFont(FONT_SIZE_MEDIUM);
lcd.print("Analog input:");
lcd.setCursor(160, 0);
lcd.print("Button:");
lcd.setFont(FONT_SIZE_XLARGE);
// set up pin mode
pinMode(ANALOG_PIN, INPUT);
pinMode(BUTTON_PIN, INPUT);
// set up serial port baudrate
Serial.begin(115200);
}
void loop() {
// display analog input value
int value = analogRead(ANALOG_PIN);
lcd.setTextColor(RGB16_YELLOW);
lcd.setCursor(0, 3);
lcd.printInt(value, 4);
// draw tick (when button is pressed) or cross (when button is not pressed)
int btn = digitalRead(BUTTON_PIN);
if (!btn) {
lcd.setTextColor(RGB16_GREEN);
lcd.draw2x(tick, 160, 20, 16, 16);
// reset button state
digitalWrite(BUTTON_PIN, HIGH);
} else {
lcd.setTextColor(RGB16_RED);
lcd.draw2x(cross, 160, 20, 16, 16);
}
// output analog value via serial UART
Serial.println(value);
delay(50);
}

View File

@@ -0,0 +1,89 @@
#include <SPI.h>
#include <SD.h>
#include <Wire.h>
#include <MultiLCD.h>
// set up variables using the SD utility library functions:
Sd2Card card;
SdVolume volume;
SdFile root;
const int chipSelect = 10;
// set up access to LCD screen
LCD_ILI9341 lcd;
void setup()
{
lcd.begin();
lcd.setFont(FONT_SIZE_SMALL);
lcd.setTextColor(RGB16_YELLOW);
lcd.println("Initializing SD card...");
pinMode(chipSelect, OUTPUT);
// we'll use the initialization code from the utility libraries
// since we're just testing if the card is working!
if (!card.init(SPI_FULL_SPEED, chipSelect)) {
lcd.setTextColor(RGB16_RED);
lcd.println("\nInitialization failed. Things to check:");
lcd.setTextColor(RGB16_WHITE);
lcd.println("* Is a card is inserted?");
lcd.println("* Is your wiring correct?");
lcd.println("* Does the chipSelect pin match your shield?");
return;
} else {
lcd.setTextColor(RGB16_CYAN);
lcd.println("Wiring is correct and a card is present.");
}
// print the type of card
lcd.setTextColor(RGB16_GREEN);
lcd.print("\nCard Type: ");
switch(card.type()) {
case SD_CARD_TYPE_SD1:
lcd.println("SD1");
break;
case SD_CARD_TYPE_SD2:
lcd.println("SD2");
break;
case SD_CARD_TYPE_SDHC:
lcd.println("SDHC");
break;
default:
lcd.println("Unknown");
}
lcd.setTextColor(RGB16_WHITE);
// Now we will try to open the 'volume'/'partition' - it should be FAT16 or FAT32
if (!volume.init(card)) {
lcd.println("Could not find FAT16/FAT32 partition.\nMake sure you've formatted the card");
return;
}
// print the type and size of the first FAT-type volume
uint32_t volumesize;
lcd.print("\nVolume Type: FAT");
lcd.println(volume.fatType(), DEC);
lcd.println();
volumesize = volume.blocksPerCluster(); // clusters are collections of blocks
volumesize *= volume.clusterCount(); // we'll have a lot of clusters
volumesize *= 512; // SD card blocks are always 512 bytes
lcd.print("Volume size: ");
lcd.print(volumesize);
lcd.print(" bytes (");
lcd.print(volumesize >> 20);
lcd.println("MB)");
lcd.println("\nFiles found on SD (name, date and size in bytes)");
root.openRoot(volume);
// list all files in the card with date and size
root.ls(LS_R | LS_DATE | LS_SIZE);
}
void loop(void)
{
}

View File

@@ -0,0 +1,78 @@
/*************************************************************************
* Demo sketch for monochrome displays
* Distributed under GPL v2.0
* Copyright (c) 2013-14 Stanley Huang <stanleyhuangyc@live.com>
* All rights reserved.
*************************************************************************/
#include <Arduino.h>
#include <Wire.h>
#include <SPI.h>
#include <MultiLCD.h>
//LCD_SH1106 lcd; /* for SH1106 OLED module */
LCD_SSD1306 lcd; /* for SSD1306 OLED module */
//LCD_PCD8544 lcd; /* for LCD4884 shield or Nokia 5100 screen module */
//LCD_ILI9325D lcd; /* for Itead 2.8" TFT LCD shield */
//LCD_ILI9341 lcd; /* for Freematics 2.2" TFT LCD shield */
static const PROGMEM uint8_t smile[48 * 48 / 8] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0xE0,0xF0,0xF8,0xF8,0xFC,0xFC,0xFE,0xFE,0x7E,0x7F,0x7F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x7F,0x7F,0x7E,0xFE,0xFE,0xFC,0xFC,0xF8,0xF8,0xF0,0xE0,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0xC0,0xF0,0xFC,0xFE,0xFF,0xFF,0xFF,0x3F,0x1F,0x0F,0x07,0x03,0x01,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x01,0x03,0x07,0x0F,0x1F,0x3F,0xFF,0xFF,0xFF,0xFE,0xFC,0xF0,0xC0,0x00,
0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x1F,0x1F,0x1F,0x3F,0x1F,0x1F,0x02,0x00,0x00,0x00,0x00,0x06,0x1F,0x1F,0x1F,0x3F,0x1F,0x1F,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,
0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xE0,0x00,0x00,0x30,0xF8,0xF8,0xF8,0xF8,0xE0,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0xE0,0xF8,0xF8,0xFC,0xF8,0x30,0x00,0x00,0xE0,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,
0x00,0x03,0x0F,0x3F,0x7F,0xFF,0xFF,0xFF,0xFC,0xF8,0xF0,0xE1,0xC7,0x87,0x0F,0x1F,0x3F,0x3F,0x3E,0x7E,0x7C,0x7C,0x7C,0x78,0x78,0x7C,0x7C,0x7C,0x7E,0x3E,0x3F,0x3F,0x1F,0x0F,0x87,0xC7,0xE1,0xF0,0xF8,0xFC,0xFF,0xFF,0xFF,0x7F,0x3F,0x0F,0x03,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x07,0x0F,0x1F,0x1F,0x3F,0x3F,0x7F,0x7F,0x7E,0xFE,0xFE,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFE,0xFE,0x7E,0x7F,0x7F,0x3F,0x3F,0x1F,0x1F,0x0F,0x07,0x03,0x01,0x00,0x00,0x00,0x00,0x00,0x00,
};
static const PROGMEM uint8_t tick[16 * 16 / 8] =
{0x00,0x80,0xC0,0xE0,0xC0,0x80,0x00,0x80,0xC0,0xE0,0xF0,0xF8,0xFC,0x78,0x30,0x00,0x00,0x01,0x03,0x07,0x0F,0x1F,0x1F,0x1F,0x0F,0x07,0x03,0x01,0x00,0x00,0x00,0x00};
static const PROGMEM uint8_t cross[16 * 16 / 8] =
{0x00,0x0C,0x1C,0x3C,0x78,0xF0,0xE0,0xC0,0xE0,0xF0,0x78,0x3C,0x1C,0x0C,0x00,0x00,0x00,0x30,0x38,0x3C,0x1E,0x0F,0x07,0x03,0x07,0x0F,0x1E,0x3C,0x38,0x30,0x00,0x00};
void setup()
{
lcd.begin();
}
void loop()
{
lcd.clear();
// draw bitmap of 48x48 pixels
lcd.setCursor(40, 0);
lcd.draw(smile, 48, 48);
// draw bitmap of 16x16 pixels
lcd.setCursor(0, 6);
lcd.draw(tick, 16, 16);
lcd.draw(cross, 16, 16);
delay(1000);
// display string
lcd.clear();
lcd.setFont(FONT_SIZE_SMALL);
lcd.println("Hello, world!");
lcd.setFont(FONT_SIZE_MEDIUM);
lcd.println("Hello, world!");
// display numbers
lcd.setCursor(0, 3);
lcd.setFont(FONT_SIZE_SMALL);
lcd.printLong(12345678);
lcd.setCursor(64, 3);
lcd.setFont(FONT_SIZE_MEDIUM);
lcd.printLong(12345678);
lcd.setCursor(0, 4);
lcd.setFont(FONT_SIZE_LARGE);
lcd.printLong(12345678);
lcd.setCursor(0, 6);
lcd.setFont(FONT_SIZE_XLARGE);
lcd.printLong(12345678);
delay(3000);
}

View File

@@ -0,0 +1,80 @@
/*************************************************************************
* Demo sketch of Arduino Text Display Library for Multiple LCDs
* Distributed under GPL v2.0
* Copyright (c) 2013 Stanley Huang <stanleyhuangyc@live.com>
* All rights reserved.
*************************************************************************/
#include <Arduino.h>
#include <Wire.h>
#include <SPI.h>
#include <MultiLCD.h>
LCD_ILI9341 lcd; /* for 2.2" SPI TFT module */
//LCD_ILI9325D lcd; /* for 2.8" TFT shield */
static const PROGMEM uint8_t smile[48 * 48 / 8] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0xE0,0xF0,0xF8,0xF8,0xFC,0xFC,0xFE,0xFE,0x7E,0x7F,0x7F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x7F,0x7F,0x7E,0xFE,0xFE,0xFC,0xFC,0xF8,0xF8,0xF0,0xE0,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0xC0,0xF0,0xFC,0xFE,0xFF,0xFF,0xFF,0x3F,0x1F,0x0F,0x07,0x03,0x01,0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,0x00,0x00,0x00,
};
static const PROGMEM uint8_t tick[16 * 16 / 8] =
{0x00,0x80,0xC0,0xE0,0xC0,0x80,0x00,0x80,0xC0,0xE0,0xF0,0xF8,0xFC,0x78,0x30,0x00,0x00,0x01,0x03,0x07,0x0F,0x1F,0x1F,0x1F,0x0F,0x07,0x03,0x01,0x00,0x00,0x00,0x00};
static const PROGMEM uint8_t cross[16 * 16 / 8] =
{0x00,0x0C,0x1C,0x3C,0x78,0xF0,0xE0,0xC0,0xE0,0xF0,0x78,0x3C,0x1C,0x0C,0x00,0x00,0x00,0x30,0x38,0x3C,0x1E,0x0F,0x07,0x03,0x07,0x0F,0x1E,0x3C,0x38,0x30,0x00,0x00};
void setup()
{
lcd.begin();
}
void loop()
{
lcd.clear();
lcd.setTextColor(255, 0, 255);
lcd.setXY(40, 10);
lcd.draw(smile, 48, 48);
lcd.setTextColor(255, 255, 255);
lcd.setCursor(0, 10);
lcd.setFont(FONT_SIZE_SMALL);
lcd.print("Hello, world!");
lcd.setTextColor(255, 255, 0);
lcd.setCursor(0, 11);
lcd.setFont(FONT_SIZE_MEDIUM);
lcd.print("Hello, world!");
lcd.setTextColor(255, 0, 0);
lcd.setCursor(0, 13);
lcd.setFont(FONT_SIZE_SMALL);
lcd.printLong(1234567890);
lcd.setTextColor(0, 255, 0);
lcd.setCursor(0, 14);
lcd.setFont(FONT_SIZE_MEDIUM);
lcd.printLong(1234567890);
lcd.setTextColor(0, 0, 255);
lcd.setCursor(0, 16);
lcd.setFont(FONT_SIZE_LARGE);
lcd.printLong(12345678);
lcd.setTextColor(0, 255, 255);
lcd.setCursor(0, 18);
lcd.setFont(FONT_SIZE_XLARGE);
lcd.printLong(12345678);
lcd.setXY(30, 200);
lcd.setTextColor(0, 255, 0);
lcd.draw2x(tick, 16, 16);
lcd.setTextColor(255, 0, 0);
lcd.draw2x(cross, 16, 16);
delay(10000);
}