本文整理汇总了C++中LiquidCrystal_I2C::print方法的典型用法代码示例。如果您正苦于以下问题:C++ LiquidCrystal_I2C::print方法的具体用法?C++ LiquidCrystal_I2C::print怎么用?C++ LiquidCrystal_I2C::print使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LiquidCrystal_I2C
的用法示例。
在下文中一共展示了LiquidCrystal_I2C::print方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: secret_button
void secret_button()
{
static unsigned long but1;
but1 = millis();
Serial.println(F("1"));
while(!digitalRead(ON_PIN)){
delay(20);
if (millis() > but1 + 5000){
go_sleep();
}
}
but1 = millis();
while(millis() < but1 + BUTTON1_DELAY){delay(20);
if(!digitalRead(ON_PIN)){
Serial.println(F("2"));
while(!digitalRead(ON_PIN)){delay(20);}
but1 = millis();
while(millis() < but1 + BUTTON1_DELAY){delay(20);
if(!digitalRead(ON_PIN)){
Serial.println(F("3"));
while(!digitalRead(ON_PIN)){delay(20);}
but1 = millis();
while(millis() < but1 + BUTTON1_DELAY){delay(20);
if(!digitalRead(ON_PIN)){
Serial.println(F("4"));
while(!digitalRead(ON_PIN)){delay(20);}
but1 = millis();
while(millis() < but1 + BUTTON1_DELAY){delay(20);
if(!digitalRead(ON_PIN)){
Serial.println(F("5"));
but1 = millis();
while(!digitalRead(ON_PIN)){delay(20);
Serial.println(F("6"));
if(millis() > but1 + 800){
Serial.println(F("Release now!"));
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(F("Release now!"));
delay(500);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(F("Press: open box"));
lcd.setCursor(0,1);
lcd.print(F("Hold: reset game"));
delay(1000);
while(digitalRead(ON_PIN)){}
but1 = millis();
while(!digitalRead(ON_PIN)){delay(20);}
if(millis() - but1 > 1000){
lcd.clear();
lcd.print(F("RESET GAME!"));
delay(3000);
target = 1;
EEPROM.write(EEPROM_TARGET_INDEX, 1);
break;
}
else {
open_box();
delay(15000);
close_box();
break;
}
}
}
}
}
}
}
}
}
}
}
}
示例2: displayNext
/**
0123456789012345
��ʼ
-
Sample data...
**DFRobot**
-
20:00 -19.9C
99%RH 1005hPa
-
31th-C A=-19.9C
H=-19.9C L=-19.9C
31th-RH A=99%
H=99% L=99%
31th-hPa A=1005
H=1005 L=1005
-
30th-C A=-19.9C
H=-19.9C L=-19.9C
30th-RH A=99%
H=99% L=99%
30th-hPa A=1005
H=1005 L=1005
TEMP(C)
T or TEMP
P or
RH
**/
void WeatherStation::displayNext()
{
uint8_t i;
uint8_t dataType;
uint8_t lcdCurrentRow;
uint8_t date;
int16_t data;
uint8_t &days = displayMgt.days;
uint8_t &measureIndex = displayMgt.measureIndex;
bool &dateShowFlag = displayMgt.dateShowFlag;
uint8_t &nowDataIndex = displayMgt.nowDataIndex;
String &rowInfo = displayMgt.rowInfo;
String unitWord;
/**display current**/
DBG_PRINTLN_VAR(days,DEC);
DBG_PRINTLN_VAR(nowDataIndex,DEC);
DBG_PRINTLN_VAR(measureIndex,DEC);
lcd.clear();
lcdCurrentRow = 0;
/**display date**/
if ( !dateShowFlag )
{
rowInfo = "";
rowInfo += currentYear;
rowInfo += "/";
rowInfo += currentMonth;
rowInfo += "/";
rowInfo += currentDate;
rowInfo += " ";
rowInfo += currentHour;
rowInfo += ":";
rowInfo += currentMinute;
lcd.setCursor( 0, lcdCurrentRow++ );
lcd.print( rowInfo );
rowInfo = " "; //one space before data
dateShowFlag = true;
}
/**display current data**/
if ( dateShowFlag && (nowDataIndex < measureNum) )
{
for ( i = nowDataIndex; i < measureNum; i++ )
{
if ( false == a_measureData[i].valid )
{
break;
}
dataType = a_measureData[i].dataType;
data = a_measureData[i].p_sensor->getValue( dataType );
//.........这里部分代码省略.........
示例3: loop
void loop()
{
//Serial.print(F("Free RAM1:")); Serial.println(freeRam());
// Check secret button
but = !digitalRead(ON_PIN);
if(but){
Serial.println(F("Button pressed"));
secret_button();
}
bool GPS_debug = 0;
unsigned long t = millis();
while (ss.available() > 0 || t + 1100 < millis()){
gps.encode(ss.read());
GPS_debug = 1;
}
if (GPS_debug) {
Serial.println(F("GPS received"));
GPS_debug = 0;
}
sats_fix = gps.satellites.value();
hdop = gps.hdop.value();
position_lat = gps.location.lat();
position_lon = gps.location.lng();
//target = 3; // debug
distance = gps.distanceBetween(position_lat, position_lon, target_lat[target], target_lon[target]);
//distance = 4; // debug
static int sim, ok;
#ifdef SIMULATION
if (but == 1){
sim = 1;
delay (1000);
}
else {
sim = 0;
lcd.setCursor(14, 1);
lcd.print(target);
}
if (distance > 30 && sim == 0){
#else
if (distance > 30) {
#endif
lcd_target(lcd, target, distance, sats_fix);
}
else {
#ifdef BUTTON_FOR_NEXT_STEP
wait finish;
finish.set_time(2500);
finish.set_steps(2);
lcd.setCursor(0, 0);
if(finish.step() == 1){
lcd.print(F("You are at your "));
lcd.setCursor(0, 1);
lcd.print(F("current target."));
}
if (finish.step() == 2){
lcd.setCursor(0, 0);
lcd.print(F("Press the button"));
lcd.setCursor(0, 1);
lcd.print(F("to continue... "));
}
if (but == 1){
// Go to next target
target++;
ok = 1;
}
#else
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(F("You are at your "));
lcd.setCursor(0, 1);
lcd.print(F("current target."));
target++;
delay(5000);
but = 0;
#endif
// Open the box at the end of game
if(target > NUMBER_OF_TARGETS){
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(F("CONRATULATIONS! "));
delay(5000);
open_box();
}
else {
EEPROM.write(EEPROM_TARGET_INDEX, target);
}
//.........这里部分代码省略.........
示例4: robot_command
int robot_command (uint16_t *cmd, uint16_t *resp, uint8_t *resplen)
{
unsigned long start = 0;
uint8_t infolen = 0;
int checkdir;
int motor_state_save;
int error = -1;
int ret = SUCCESS;
lcd.clear(); // clear LCD
reset_leds(); // turn off all leds
digitalWrite(Led_Blue, HIGH); // turn on led blue
switch (cmd[0]) {
case CMD_STOP:
Serial.println("CMD_STOP");
lcd.print("STOP");
stop();
motor_state = STATE_STOP;
*resplen = 0;
break;
case CMD_START:
if (cmd[1] == 0)
{
Serial.println("CMD_START");
lcd.print("START");
start_forward();
}
else
{
Serial.print("CMD_START_TEST motor: "); Serial.println((int)cmd[1]);
lcd.print("START motor: "); lcd.print((int)cmd[1]);
start_forward_test(cmd[1]);
}
motor_state = STATE_GO;
*resplen = 0;
break;
case CMD_CHECK_AROUND:
Serial.println("CMD_CHECK_AROUND");
lcd.print("CHECK AROUND");
checkdir = check_around();
lcd.setCursor(0,1);
if (checkdir == DIRECTION_LEFT) lcd.print("LEFT");
else if (checkdir == DIRECTION_RIGHT) lcd.print("RIGHT");
else if (checkdir == OBSTACLE_LEFT) lcd.print("OBSTACLE LEFT");
else if (checkdir == OBSTACLE_RIGHT) lcd.print("OBSTACLE RIGHT");
else if (checkdir == OBSTACLE) lcd.print("OBSTACLE");
else lcd.print("?");
resp[0] = checkdir;
*resplen = 0+1;
break;
case CMD_MOVE_TILT_PAN:
Serial.print("CMD_MOVE_TILT_PAN: "); Serial.print((int)cmd[1]);Serial.print((int)cmd[2]);Serial.print((int)cmd[3]);Serial.println((int)cmd[4]);
if (cmd[2] == 0) HPos = (int)cmd[1] + 90; else HPos = 90 - (int)cmd[1];
if (cmd[4] == 0) VPos = (int)cmd[3] + 90; else VPos = 90 - (int)cmd[3];
Serial.print("CMD_MOVE_TILT_PAN, HPos VPos: "); Serial.print(HPos);Serial.println(VPos);
lcd.print("MOVE TILT&PAN");
lcd.setCursor(0,1);
lcd.print("X: ");
lcd.print(HPos);
lcd.print(" Y: ");
lcd.print(VPos);
TiltPan_move(HPos, VPos);
*resplen = 0;
break;
case CMD_TURN:
if (cmd[1] == 180)
{
Serial.print("CMD_TURN_BACK");
lcd.print("TURN BACK ");
ret = turnback (10); // 10s max
if (ret != SUCCESS){
Serial.print("turnback error"); Serial.println(ret);
lcd.setCursor(0,1);
lcd.print("turnback error: "); lcd.print(ret);
error = 1;
}
}
else if (motor_state == STATE_GO)
{
Serial.print("CMD_TURN, alpha: "); Serial.print((cmd[2] != 1) ? ('+'):('-')); Serial.println((int)cmd[1]);
lcd.print("TURN"); lcd.print((cmd[2] != 1) ? ('+'):('-')); lcd.print((int)cmd[1]);lcd.print((char)223); //degree
ret = turn ((double)((cmd[2] != 1) ? (cmd[1]):(-cmd[1])), 5); // 5s max
if (ret != SUCCESS){
Serial.print("turn error"); Serial.println(ret);
//.........这里部分代码省略.........
示例5: robot_begin
int robot_begin()
{
int ret = SUCCESS;
int ivalue = 0;
ret = motor_begin();
if (ret != SUCCESS) return ret;
Serial.println("Begin Robot Init");
Serial.println("****************");
lcd.clear();
lcd.print("Begin Robot Init");
pinMode(Led_Green, OUTPUT); // set the pin as output
blink(Led_Green);
pinMode(Led_Red, OUTPUT); // set the pin as output
blink(Led_Red);
pinMode(Led_Blue, OUTPUT); // set the pin as output
blink(Led_Blue);
Serial.println("Init Leds OK");
// initialize the buzzer
pinMode(buzzPin, OUTPUT);
buzz(3);
Serial.println("Init Buzzer OK");
// initialize the Tilt&Pan servos
TiltPan_begin(HSERVO_Pin, VSERVO_Pin);
Serial.println("Init Tilt&Pan servos OK");
// initialize the camera
Serial.println(" ");
Serial.println("Begin Init Camera...");
ret=JPEGCamera.begin();
if (ret != SUCCESS)
{
Serial.print("Error Init Camera, error: ");
Serial.println(ret);
lcd.setCursor(0,1);
lcd.print("Init Camera KO ");
}
else
{
Serial.println("Init Camera OK");
lcd.setCursor(0,1);
lcd.print("Init Camera OK ");
}
delay(5*1000);lcd.clear();
// initialize the SD-Card
ret = initSDCard();
if (ret != SUCCESS)
{
Serial.print("Error Init SD-Card, error: ");
Serial.println(ret);
lcd.print("Init SD-Card KO ");
}
else
{
Serial.println("Init SD-Card OK");
lcd.print("Init SD-Card OK ");
}
// get infos from SD-Card
ret=infoSDCard();
if (ret < 0)
{
Serial.print("Error Infos SD-Card, error: ");
Serial.println(ret);
lcd.setCursor(0,1);
lcd.print("Err Infos SDCard");
}
else
{
no_picture = ret+1;
Serial.print("no_picture starts at: ");
Serial.println(no_picture);
lcd.setCursor(0,1);
lcd.print("Num picture:");lcd.print(no_picture);
}
delay(5*1000);lcd.clear();
// initialize the brightness sensor
TEMT6000.TEMT6000_init(TEMT6000_Pin); // initialize the pin connected to the sensor
Serial.println("Init Brightness sensor OK");
ivalue = TEMT6000.TEMT6000_getLight();
Serial.print("Value between 0 (dark) and 1023 (bright): ");
Serial.println(ivalue);
lcd.print("Lux:");lcd.print(ivalue);lcd.printByte(lcd_pipe);
// initialize the temperature sensor
TMP102.TMP102_init();
Serial.println("Init Temperature sensor OK");
double temperature = TMP102.TMP102_read();
ivalue = (int)(100.0 * temperature);
Serial.print("Temperature: ");
//.........这里部分代码省略.........
示例6: FindTension
double FindTension()
{
// ********* First part sweeps increasing frequency************
connection = true; //assume a wire is connected abefore testing if it is not
dfreq = lowfreq - 100.0; //start at lower freq to allow supply stabilisation before starting to sample
foundmaxdn = false;
foundmaxup = false;
centrefreq = 0;
lcd.setCursor(0, 0);
lcd.print(" RUNNING ");
sweep = true;
while (sweep == true)
{
if (sinevalue >= 254 ) // test if we are in the undriven half cycle
{
if (adcflag == 1 && dfreq <= lowfreq - 90.0) // test if outside scan range and sample adc2
{
adcflag = 0; // if adc2 is 30 * 4.9mV then there is no wire connected
connection = true; // assume wire is connected
if (analogRead(2) > 30)
{ connection = false; // no wire connected
lcd.setCursor(0, 2);
lcd.print("F NO WIRE ");
lcd.setCursor(0, 3);
lcd.print("T ");
}
}
if (adcflag == 1 && dfreq > lowfreq) // test if within scan range
{ // adcflag=0;
sbi(PORTD, 6); cbi(PORTD, 6); // Test /reset PORTD,6 high to observe timing at start of analog read
analogval = analogRead(0); // get value of signal from wire
if (analogval > maxanalogval)
{ maxanalogval = analogval;
centrefreq = dfreq;
overmaxcount = 0;
}
if (analogval < maxanalogval - 4)
{ overmaxcount++;
if (overmaxcount >= maxcountlimit) {
foundmaxup = true;
}
}
}
}
if (pulsecount > cycles) // keep same frequency for n cycles
{ pulsecount = 0;
dfreq = dfreq + 4.0; //Increment scan freq by a few Hz
cbi (TIMSK2, TOIE2); // disable Timer2 Interrupt
tword_m = pow(2, 32) * dfreq / refclk; // calculate new tuning word
sbi (TIMSK2, TOIE2); // enable Timer2 Interrupt
// test if sweep finished
if (dfreq > highfreq || overmaxcount > maxcountlimit )
{
centrefrequpKHz = 0;
centrefrequpKHz = centrefreq / 1000.0;
lcd.setCursor(15, 2);
lcd.print(" ");
lcd.setCursor(2, 2);
if (connection == true && centrefrequpKHz != 0)
{ lcd.print(centrefrequpKHz);
Tensionup = 0;
Tensionup = LMDX * centrefrequpKHz * centrefrequpKHz; // in grams
lcd.setCursor(2, 3);
lcd.print(Tensionup);
}
maxanalogval = 0;
overmaxcount = 0;
lcd.setCursor(15, 2);
lcd.print(" "); // now clear average values on LCD
lcd.setCursor(15, 3);
lcd.print(" ");
sweep = false;
}
}
}
// ********* Second part sweeps decreasing frequency************
dfreq = highfreq + 100.0; //start at Higher freq to allow supply stabilisation before starting to sample
maxanalogval = 0;
overmaxcount = 0;
sweep = true;
while (sweep == true)
{
if (sinevalue >= 254 ) // test if we are in the undriven half cycle
{
if (adcflag == 1 && dfreq < highfreq) // test if within scan range
{
sbi(PORTD, 6); cbi(PORTD, 6); // Test /reset PORTD,6 high to observe timing at start of analog read
analogval = analogRead(0);
if (analogval > maxanalogval)
{ maxanalogval = analogval;
centrefreq = dfreq;
//.........这里部分代码省略.........
示例7: setSoilHumidity
void setSoilHumidity() {
lcd.clear();
lcd.print("Soil moisture");
lcd.setCursor(0, 1);
lcd.print("Soil moisture");
}
示例8: navigationCheckDestination
bool navigationCheckDestination()
{
//Only process line following if navigation destination is known
if ( currentNavigationDestination < 0 )
{
lcd.clear();
lcd.print( "Where am I going?" );
lcdSelectDestination();
#ifdef AUTO_RETURN_HOME
unsigned long navigationDestinationPromptTime = millis();
#endif
while ( digitalRead(LCD_UP_PIN) == HIGH ||
digitalRead(LCD_DOWN_PIN) == HIGH ||
digitalRead(LCD_PLAY_PIN) == HIGH ||
digitalRead(LCD_STOP_PIN) == HIGH
)
{
#ifdef AUTO_RETURN_HOME
if ( currentNavigationLocation != currentNavigationHome && navigationDestinationPromptTime + navigationReturnHomeTimeout * 1000ul < millis() )
{
//Timeout has occured.. we are going to return home
lcd.setCursor(0, 1);
lcd.print( navigationReturnHomeTimeout );
lcd.print( " second timeout." );
navigationReturnHome();
break;
}
#endif
if ( digitalRead(LCD_UP_PIN) == LOW )
{
navigationSounds->play( soundUp );
if ( --lcdCurrentSelection < 0 ) lcdCurrentSelection = MAP_LOCATION_COUNT - 1;
break;
}
if ( digitalRead(LCD_DOWN_PIN) == LOW )
{
navigationSounds->play( soundDown );
if ( ++lcdCurrentSelection == MAP_LOCATION_COUNT ) lcdCurrentSelection = 0;
break;
}
if ( digitalRead(LCD_PLAY_PIN) == LOW )
{
if ( lcdCurrentSelection != currentNavigationLocation )
{
navigationSounds->play( soundUhoh );
currentNavigationDestination = lcdCurrentSelection;
/*
Serial.print( "Current Destination: " );
Serial.print( currentNavigationDestination );
Serial.print( ": " );
Serial.println( destinationList[currentNavigationDestination] );
*/
lcd.clear();
lcd.print( "Traveling from:" );
lcd.setCursor(0, 1); lcd.print( destinationList[currentNavigationLocation] );
lcd.setCursor(0, 2); lcd.print( "to:" );
lcd.setCursor(0, 3); lcd.print( destinationList[currentNavigationDestination] );
delay(1000);
break;
}
else
{
navigationSounds->play( soundOhh );
}
}
if ( navigationCheckEStop() )
{
navigationSounds->play( soundButtonPushed );
currentNavigationLocation = -1; //Returning to previous question
return false;
}
}
return false;
}
return true;
}
示例9: loop
/*--(end setup )---*/
void loop() /*----( LOOP: RUNS CONSTANTLY )----*/
{
loopCount = 0;
changeState = digitalRead(ChangeScanBtn);
if (!changeState)
{
if (scanRange == 1) //scan range start high
{
scanRange = 0;
for (int i = 0; i < 100; i++){
scanRange = 0; //terrible hack to add delay
Serial.print("wait");
}
//LOW SCAN
double lowfreq = 800.0; // 1115.0 calculated frequency for 0.3N ( 30gm) tension of 79mm wire ORIGINAL
double highfreq = 1600.0; // 1703.0 calculated frequency for 0.7N (70gm) tension ORIGINAL
lcd.setCursor(19,0);//if button pressed and set to high currently
lcd.print("L");//then change to low
lcd.setCursor(0,3);
lcd.print("LowFreq = 800-1600Hz");
//change global vars here for scan range.
}
else if (scanRange == 0)
{
scanRange = 1;
for (int i = 0; i < 100; i++){
scanRange = 1; //terrible hack to add delay
Serial.print("wait") ;
}
//HIGH SCAN
double lowfreq = 1115.0; // 1115.0 calculated frequency for 0.3N ( 30gm) tension of 79mm wire
double highfreq = 1900.0; // upped frequency to reach above 70gm
//change global vars here
lcd.setCursor(19,0);
lcd.print("H");
lcd.setCursor(0,3);
lcd.print("HiFreq = 1115-1900Hz");
}
}
buttonState = digitalRead(RunBtn);
if (!buttonState)
do
{
if (loopCount == 0)
{
lcd.setCursor(0,2);
lcd.print(" ");
lcd.setCursor(0,3);
lcd.print(" ");
}
loopCount = loopCount+1;
lcd.setCursor(0, 1);
lcd.print(" UP DOWN AVG ");
lcd.setCursor(0, 2);
lcd.print("F");
lcd.setCursor(0, 3);
lcd.print("T");
TensionCalcd = FindTension();
lcd.setCursor(15, 3);
lcd.print(TensionCalcd);
if (loopCount == 2 && TensionCalcd != 0) {
lcd.setCursor(0, 0);
lcd.print(" FINISHED ");
break;
}
if (TensionCalcd == 0){
lcd.setCursor(0, 0);
lcd.print(" FINISHED ");
lcd.setCursor(0, 1);
lcd.print(" ");
lcd.setCursor(0, 2);
lcd.print(" NO SIGNAL ");
lcd.setCursor(0, 3);
lcd.print(" ");
break;
}
}
while (loopCount < 3);
}
示例10: LcdPrint
void LcdPrint(const char c[]) {
lcd27.print(c);
lcd3E.print(c);
}
示例11: LcdPrintX
void LcdPrintX(LiquidCrystal_I2C lcd, const char c[]) { lcd.print(c); }
示例12: updatelcd
void updatelcd()
{
lcd.clear();
lcd.setCursor(0,0);
lcd.print("XT");
lcd.setCursor(3,0);
lcd.print(_XEncoderTicks);
lcd.setCursor(10,0);
lcd.print("XI");
lcd.setCursor(13,0);
lcd.print(_XEncoderIndex);
lcd.setCursor(18,0);
lcd.print("X");
lcd.setCursor(19,0);
lcd.print(">" + _XMinPinSet);
lcd.setCursor(17,0);
lcd.print("<" + _XMaxPinSet);
lcd.setCursor(0,1);
lcd.print("YI");
lcd.setCursor(3,1);
lcd.print(_YEncoderTicks);
lcd.setCursor(10,1);
lcd.print("YI");
lcd.setCursor(13,1);
lcd.print(_YEncoderIndex);
lcd.setCursor(18,1);
lcd.print("Y");
lcd.setCursor(19,1);
lcd.print("V" + _YMinPinSet);
lcd.setCursor(17,1);
lcd.print("^" + _YMaxPinSet);
/*
lcd.setCursor(15,0);
lcd.print(_XCsens);*/
lcd.setCursor(3,3);
lcd.print("<" + _XJoyLeft);
lcd.setCursor(5,3);
lcd.print(">" + _XJoyRight);
lcd.setCursor(4,3);
lcd.print("^" + _YJoyUp);
lcd.setCursor(4,3);
lcd.print("V" + _YJoyDown);
delay(20);
}
示例13: setup
// { SPECIAL FUNCTIONS -------------------------------------------------------
void setup(){
// Required if SYSTEM_MODE = SEMI_AUTOMATIC or MANUAL
// if(Particle.connected() == false){
// Particle.connect();
// }
pinMode(BOARD_LED, OUTPUT); //INPUT, INPUT_PULLUP, INPUT_PULLDOWN or OUTPUT
// pinMode(DAC, OUTPUT); //INPUT, INPUT_PULLUP, INPUT_PULLDOWN or OUTPUT
// pinMode( D6, INPUT );
// attachInterrupt( D6, on_d6, CHANGE, 13);
// Note: do not set the pinMode() with analogRead(). The pinMode() is
// automatically set to AN_INPUT the first time analogRead() is called
// src: https://docs.particle.io/reference/firmware/photon/#analogread-adc-
// In other words, don't do: pinMode(analog_pin, INPUT);
// { Declare Cloud Variables/Functions/Events ----------------------------
// Up to 20 Variables
Particle.variable("help", HELP);
Particle.variable("a", PV_a);
Particle.variable("b", PV_a);
Particle.variable("c", PV_a);
// Up to 15 Functions.
Particle.function("do", PF_do);
Particle.function("set", PF_set);
#ifdef USE_STDIN
Particle.function("stdin", PF_stdin);
#endif // USE_STDIN
// Up to 4 Event Subscriptions
Particle.subscribe("all", PS_handler, MY_DEVICES);
// For documentation specify what events you will publish:
// Particle.publish("stdout", "...")
// Particle.publish("stderr", "...")
// } Declare Cloud Variables/Functions/Events ----------------------------
strcpy(PV_a, "Hello World");
#ifdef USE_LCD
lcd.init();
lcd.backlight();
lcd.clear();
lcd.setCursor(0,1);
lcd.print("Hello World");
#endif
#ifdef USE_SERIAL0
Serial.begin(9600);
#endif // USE_SERIAL0
#ifdef USE_SERIAL1
Serial1.begin(9600);
#endif // USE_SERIAL1
#ifdef USE_TIMER_2SEC
timer_2sec.start();
#endif // USE_TIMER_2SEC
}
示例14: loop
void loop()
{
sen1.requestTemperatures();
sen2.requestTemperatures();
sen3.requestTemperatures();
sen4.requestTemperatures();
sen5.requestTemperatures();
echoSerial();
delay(1000);
echoSerial();
delay(1000);
digitalWrite ( BACKLIGHT_PIN, HIGH );
if(sen1.getTempCByIndex(0) < 80){
tmp1=sen1.getTempCByIndex(0);
}
if(sen2.getTempCByIndex(0) < 80){
tmp2=sen2.getTempCByIndex(0);
}
if(sen3.getTempCByIndex(0) < 80){
tmp3=sen3.getTempCByIndex(0);
}
if(sen4.getTempCByIndex(0) < 80){
tmp4=sen4.getTempCByIndex(0);
}
if(sen5.getTempCByIndex(0) < 80){
tmp5=sen5.getTempCByIndex(0);
}
lcd.home (); // go home
lcd.print("T1=");
lcd.print(tmp1);
lcd.print(" T2=");
lcd.print(tmp2);
lcd.setCursor ( 0, 1 ); // go to the next line
lcd.print("T3=");
lcd.print(tmp3);
lcd.print(" T4=");
lcd.print(tmp4);
Serial.print(tmp1);
Serial.print("|");
Serial.print(tmp2);
Serial.print("|");
Serial.print(tmp3);
Serial.print("|");
Serial.print(tmp4);
Serial.print("|");
Serial.print(tmp5);
Serial.println(";");
for(int i=0;i<5;i++){
echoSerial();
delay(1000);
}
digitalWrite ( BACKLIGHT_PIN, LOW );
}