void init() { spiffs_mount(); // Mount file system, in order to work with files Serial.begin(SERIAL_BAUD_RATE); // 115200 by default Serial.systemDebugOutput(false); // Debug output to serial ActiveConfig = loadConfig(); // Select control line pinMode(CONTROL_PIN, OUTPUT); // DHT sensor start dht.begin(); lcd.begin(16, 2); lcd.backlight(); lcd.createChar(1, icon_termometer); lcd.createChar(2, icon_water); lcd.createChar(3, celsius); lcd.createChar(4, icon_retarrow); lcd.createChar(5, icon_clock); lcd.createChar(6, icon_cross); lcd.createChar(7, icon_check); WifiStation.config(ActiveConfig.NetworkSSID, ActiveConfig.NetworkPassword); WifiStation.enable(true); WifiAccessPoint.enable(false); WifiStation.waitConnection(connectOk, 20, connectFail); // We recommend 20+ seconds for connection timeout at start procTimer.initializeMs(5000, process).start(); process(); }
void init() { Serial.begin(SERIAL_BAUD_RATE); Serial.systemDebugOutput(true); // Allow debug print to serial Serial.println("Sming. Let's do smart things!"); Wire.pins(2, 0); lcd.begin(16, 2); lcd.backlight(); lcd.clear(); lcd.setCursor(0, 0); lcd.print("DATE: 00/00/0000"); lcd.setCursor(0, 1); lcd.print("TIME: 00:00"); // Station - WiFi client WifiStation.enable(true); WifiStation.config(WIFI_SSID, WIFI_PWD); // Put you SSID and Password here // set timezone hourly difference to UTC SystemClock.setTimeZone(7); // Run our method when station was connected to AP (or not connected) WifiStation.waitConnection(connectOk, 30, connectFail); // We recommend 20+ seconds at start }
void setup()/*----( SETUP: RUNS ONCE )----*/ { lcd.begin(20, 4); // initialize the lcd for 20 chars 4 lines and turn on backlight // Open serial communications and wait for port to open: Serial.begin(9600); // --- button setup pinMode(RunBtn, INPUT); pinMode(ChangeScanBtn, INPUT); digitalWrite(RunBtn, HIGH); digitalWrite(ChangeScanBtn, HIGH); pinMode(clampPin, OUTPUT); // sets the digital pin as OUTPUT to drive FET clamp) pinMode(5, OUTPUT); // sets the digital pin as output pinMode(6, OUTPUT); // sets the digital pin as output pinMode(7, OUTPUT); // sets the digital pin as output pinMode(11, OUTPUT); // pin11= PWM output / frequency output //Will Turner - This could go to pin 5 from 11. CHANGED TO 9 AS IT WOULDNT REACH OTHERS // ------- Quick 3 blinks of backlight ------------- for (int i = 0; i < 3; i++) { lcd.backlight(); delay(20); lcd.noBacklight(); delay(20); } lcd.backlight(); // finish with backlight on //-------- Initialise display ---------------- // NOTE: Cursor Position: CHAR, LINE) start at 0 lcd.setCursor(0, 0); //Start at character 0 on line 0 lcd.print("Tension Tester v1.5 "); // sets up the screen for the wire number and layer number being recorded lcd.setCursor(0, 2); lcd.print(" Press Run "); Setup_timer2(); // disable interrupts to avoid timing distortion cbi (TIMSK0, TOIE0); // disable Timer0 !!! delay() is now not available sbi (TIMSK2, TOIE2); // enable Timer2 Interrupt dfreq = 1000.0; // initial output frequency = 1000.o Hz tword_m = pow(2, 32) * dfreq / refclk; // calulate DDS new tuning word // setup start and end frequencies of sweep // setup initial values for loop adcflag = false; analogval = 0; digitalWrite(clampPin, HIGH); // sets the pin high to short out large signals before amp (using a FET as clamp) avgcnt = 0.0; }
void setup_display(void) { // Switch on the backlight //pinMode ( BACKLIGHT_PIN, OUTPUT ); //digitalWrite ( BACKLIGHT_PIN, HIGH ); lcd.begin(16,2); // initialize the lcd lcd.home(); }
void setup() { lcd.print("LOADING"); lcd.begin(20, 4); sensorManager.init(); initButtons(); Serial.begin(9600); setSyncProvider(RTC.get); EEPROM_readAnything(0, altitude); }
void DisplayClass::init() { lcd.begin(20, 4); // initialize the lcd lcd.home(); // go home lcd.print(F(" WATER DISPENSER")); lcd.setCursor(0, 1); lcd.print(F(" Version: "VERSION"")); lcd.setCursor(0, 2); lcd.print(F(" INITALIZING...")); lcd.setCursor(0, 3); lcd.print(F(" Tiago Conceicao")); }
void setup() { Serial.begin(115200); //Setup Channel A pinMode(X_DIR_PIN, OUTPUT); //Initiates Motor Channel A pin pinMode(Y_DIR_PIN, OUTPUT); //Initiates Motor Channel A pin pinMode(9, OUTPUT); //Initiates Brake Channel A pin pinMode(A0,INPUT); pinMode(X_MIN_PIN,INPUT_PULLUP); pinMode(X_MAX_PIN,INPUT_PULLUP); pinMode(X_JOY_LEFT,INPUT_PULLUP); pinMode(X_JOY_RIGHT,INPUT_PULLUP); pinMode(Y_JOY_DOWN,INPUT_PULLUP); pinMode(Y_JOY_UP,INPUT_PULLUP); // Quadrature encoders // X encoder pinMode(c_XEncoderPinA, INPUT); // sets pin A as input digitalWrite(c_XEncoderPinA, LOW); // turn on pullup resistors pinMode(c_XEncoderPinB, INPUT); // sets pin B as input digitalWrite(c_XEncoderPinB, LOW); // turn on pullup resistors attachInterrupt(c_XEncoderInterrupt, HandleLeftMotorInterruptA, RISING); // Y encoder pinMode(c_YEncoderPinA, INPUT); // sets pin A as input digitalWrite(c_YEncoderPinA, LOW); // turn on pullup resistors pinMode(c_YEncoderPinB, INPUT); // sets pin B as input digitalWrite(c_YEncoderPinB, LOW); // turn on pullup resistors attachInterrupt(c_YEncoderInterrupt, HandleRightMotorInterruptA, RISING); lcd.begin(20,4); // initialize the lcd for 20 chars 4 lines, turn on backlight // ------- Quick 3 blinks of backlight ------------- for(int i = 0; i< 3; i++) { lcd.backlight(); delay(150); lcd.noBacklight(); delay(150); } lcd.backlight(); // finish with backlight on //-------- Write characters on the display ------------------ // NOTE: Cursor Position: Lines and Characters start at 0 lcd.setCursor(3,0); //Start at character 4 on line 0 lcd.print("Hello, world!"); }/*--(end setup )---*/
void MyDisplay::begin() { byte error; Wire.lock(); #if DISPLAY_TYPE == DISPLAY_TYPE_SSD1306 Wire.beginTransmission(0x3c); error = Wire.endTransmission(); if (error == 0) { displayFound = TRUE; Debug.printf("Found OLED at %x\n", 0x3c); // by default, we'll generate the high voltage from the 3.3v line internally! (neat!)` // initialize with the I2C addr 0x3D (for the 128x64) // bool:reset set to TRUE or FALSE depending on you display display.begin(SSD1306_SWITCHCAPVCC, SSD1306_I2C_ADDRESS, FALSE); // display.begin(SSD1306_SWITCHCAPVCC); display.display(); } #elif DISPLAY_TYPE == DISPLAY_TYPE_20X4 Wire.beginTransmission(I2C_LCD_ADDR); error = Wire.endTransmission(); if (error == 0) { displayFound = TRUE; Debug.printf("Found LCD at %x\n", I2C_LCD_ADDR); lcd.begin(20, 4); lcd.setCursor(0, 0); lcd.print((char *)"MySensors gateway "); } else { Debug.printf("LCD not found at %x\n", I2C_LCD_ADDR); } #else Debug.println("No display available"); error = 0xff; #endif Wire.unlock(); if (displayFound) { displayTimer.initializeMs(1000, TimerDelegate(&MyDisplay::update, this)).start(true); } }
void navigationInit(PiezoEffects * mySounds) { navigationSounds = mySounds; //lcd buttons pinMode(LCD_UP_PIN, INPUT_PULLUP); pinMode(LCD_DOWN_PIN, INPUT_PULLUP); pinMode(LCD_PLAY_PIN, INPUT_PULLUP); pinMode(LCD_STOP_PIN, INPUT_PULLUP); // initialize the LCD lcd.begin(); lcd.backlight(); lcd.print("Geekbot Navigator"); }
void init() { spiffs_mount(); Serial.begin(230400); // 115200 by default Serial.systemDebugOutput(false); // Enable debug output to serial Wire.begin(); lcd.begin(16,2); // initialize the lcd for(int i = 0; i< 3; i++) { lcd.backlight(); delay(150); lcd.noBacklight(); delay(250); } lcd.backlight(); lcd.setCursor(0,0); lcd.clear(); lcd.print(" Music Box "); lcd.setCursor(0,1); lcd.print(" Geek Labs "); SystemClock.setTimeZone(3); printTimer.initializeMs(1000*60, onPrintSystemTime).start(); Serial.begin(SERIAL_BAUD_RATE); // 115200 by default Serial.systemDebugOutput(true); // Enable debug output to serial WifiStation.enable(true); WifiStation.config(WIFI_SSID, WIFI_PWD); WifiAccessPoint.enable(false); Wire.beginTransmission(PT2258_ADDRESS); Wire.write(0xC0); Wire.endTransmission(); // Run our method when station was connected to AP WifiStation.waitConnection(connectOk, 30, connectFail); }
void setup() { Serial.begin(9600); // Switch on the backlight pinMode ( BACKLIGHT_PIN, OUTPUT ); digitalWrite ( BACKLIGHT_PIN, HIGH ); lcd.begin(16,2); // initialize the lcd sen1.begin(); sen2.begin(); sen3.begin(); sen4.begin(); sen5.begin(); lcd.home (); // go home lcd.print(" getting temps "); lcd.setCursor ( 0, 1 ); // go to the next line lcd.print (" init serial "); delay ( 1000 ); digitalWrite ( BACKLIGHT_PIN, LOW); }
void LcdInitX(LiquidCrystal_I2C lcd) { lcd.begin(_sda, _scl); }
void setup() { // debugging channel Serial1.begin(57600); while (!Serial1) { delay(100); } Serial1.print( "RAM at setup " ); Serial1.println( freeRam() ); // ALRAM pinMode(ALARM_LED_PIN, OUTPUT); digitalWrite( ALARM_LED_PIN, LOW ); // must "begin" the button to get proper pin assignment/muxing b.begin(); // initializing ADC channels. The channels 0...7 are assigned to the // pins A0...A7. Note that the display and the config.txt files, as well as // the shield's silk layer use enumeration 1 to 8 ADCs[0] = AdcChannel(A0); ADCs[1] = AdcChannel(A1); ADCs[2] = AdcChannel(A2); ADCs[3] = AdcChannel(A3); ADCs[4] = AdcChannel(A4); ADCs[5] = AdcChannel(A5); ADCs[6] = AdcChannel(A6); ADCs[7] = AdcChannel(A7); // initializing actuators. The Id is 0 to 7, a bit number in // actuator byte of the ADC channel. The mapping to the pin is // pin = A8 + Id Actuators[0] = Actuator(0, true); Actuators[1] = Actuator(1, true); Actuators[2] = Actuator(2, true); Actuators[3] = Actuator(3, true); Actuators[4] = Actuator(4, true); Actuators[5] = Actuator(5, true); Actuators[6] = Actuator(6, true); Actuators[7] = Actuator(7, false); // the last actuator is not connected through ULN2003 but directly // The Real Time Clock rtc.begin(); // returns bool, but is never false Serial1.print( "RAM after rtc.begin " ); Serial1.println( freeRam() ); if(rtc.isrunning()) Serial1.println("RTC is running"); else { Serial1.println("RTC is NOT running"); rtc.adjust(DateTime(__DATE__, __TIME__)); // setup the current date and time initially } DateTime now = rtc.now(); Serial1.print(now.year(), DEC); Serial1.print('/'); Serial1.print(now.month(), DEC); Serial1.print('/'); Serial1.print(now.day(), DEC); Serial1.print(" ("); Serial1.print(daysOfTheWeek[now.dayOfTheWeek()]); Serial1.print(") "); Serial1.print(now.hour(), DEC); Serial1.print(':'); Serial1.print(now.minute(), DEC); Serial1.print(':'); Serial1.print(now.second(), DEC); Serial1.println(); // activate LCD module lcd.begin (16,2); // for 16 x 2 LCD module lcd.setBacklightPin(3,POSITIVE); lcd.setBacklight(HIGH); Serial1.print( "RAM after lcd.begin " ); Serial1.println( freeRam() ); if(!Store.begin()) { Serial1.println("Error initializing the storage"); digitalWrite( ALARM_LED_PIN, HIGH ); } Serial1.print( "RAM after Storage.begin " ); Serial1.println( freeRam() ); // the below makes sure the 1st active item is displayed upon start up. Otherwise // the item 0 is displayed, even if inactive Store.mIndex = CHANNEL_COUNT-1; Store.Advance(); }
void setup() { lcd.begin(); lcd.backlight(); }