add workPC poject

main
dugulingping 2023-10-25 10:41:57 +08:00
parent ca26f8d38f
commit dfd011f04a
6 changed files with 157 additions and 0 deletions

View File

@ -0,0 +1,45 @@
/*
Blink
Turns an LED on for one second, then off for one second, repeatedly.
Most Arduinos have an on-board LED you can control. On the UNO, MEGA and ZERO
it is attached to digital pin 13, on MKR1000 on pin 6. LED_BUILTIN is set to
the correct LED pin independent of which board is used.
If you want to know what pin the on-board LED is connected to on your Arduino
model, check the Technical Specs of your board at:
https://www.arduino.cc/en/Main/Products
modified 8 May 2014
by Scott Fitzgerald
modified 2 Sep 2016
by Arturo Guadalupi
modified 8 Sep 2016
by Colby Newman
This example code is in the public domain.
https://www.arduino.cc/en/Tutorial/BuiltInExamples/Blink
*/
const char LED_BUILTIN1 = 19;
const char LED_BUILTIN2 = 18;
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN1, OUTPUT);
pinMode(LED_BUILTIN2, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN1, HIGH); // turn the LED on (HIGH is the voltage level)
digitalWrite(LED_BUILTIN2, LOW); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN1, LOW); // turn the LED off by making the voltage LOW
digitalWrite(LED_BUILTIN2, HIGH); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}

View File

@ -0,0 +1 @@
Turn an LED on and off.

38
BasicBlink/Blink.ino Normal file
View File

@ -0,0 +1,38 @@
/*
Blink
Turns an LED on for one second, then off for one second, repeatedly.
Most Arduinos have an on-board LED you can control. On the UNO, MEGA and ZERO
it is attached to digital pin 13, on MKR1000 on pin 6. LED_BUILTIN is set to
the correct LED pin independent of which board is used.
If you want to know what pin the on-board LED is connected to on your Arduino
model, check the Technical Specs of your board at:
https://www.arduino.cc/en/Main/Products
modified 8 May 2014
by Scott Fitzgerald
modified 2 Sep 2016
by Arturo Guadalupi
modified 8 Sep 2016
by Colby Newman
This example code is in the public domain.
https://www.arduino.cc/en/Tutorial/BuiltInExamples/Blink
*/
// the setup function runs once when you press reset or power the board
const char LED_BUILTIN = 2;
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(2000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(2000); // wait for a second
}

1
BasicBlink/Blink.txt Normal file
View File

@ -0,0 +1 @@
Turn an LED on and off.

View File

@ -0,0 +1,72 @@
/*!
* @file getHumidityAndTemperature.ino
* @brief DFRobot's SHT20 Humidity And Temperature Sensor Module
* @details This example demonstrates how to read the user registers to display resolution and other settings.
* @n Uses the SHT20 library to display the current humidity and temperature.
* @n Open serial monitor at 9600 baud to see readings.
* @n Errors 998 if not sensor is detected. Error 999 if CRC is bad.
* @copyright Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com)
* @license The MIT License (MIT)
* @author [Zhangjiawei](jiawei.zhang@dfrobot.com)
* @maintainer [qsjhyy](yihuan.huang@dfrobot.com)
* @version V1.0
* @date 2021-12-03
* @url https://github.com/DFRobot/DFRobot_SHT20
*/
#include "DFRobot_SHT20.h"
#include <Wire.h>
/**
* Hardware Connections:
* -VCC = 3.3V
* -GND = GND
* -SDA = A4 (use inline 330 ohm resistor if your board is 5V)
* -SCL = A5 (use inline 330 ohm resistor if your board is 5V)
*/
DFRobot_SHT20 sht20(&Wire, SHT20_I2C_ADDR);
void setup()
{
Serial.begin(115200);
Wire.begin(23,22); //new SDA SCL pins (D6 and D4 for esp8266)
// Init SHT20 Sensor
sht20.initSHT20();
delay(100);
Serial.println("Sensor init finish!");
/**
* Check the current status information of SHT20
* Status information: End of battery, Heater enabled, Disable OTP reload
* Check result: yes, no
*/
sht20.checkSHT20();
}
void loop()
{
/**
* Read the measured data of air humidity
* Return the measured air humidity data of float type, unit: %
*/
float humd = sht20.readHumidity();
/**
* Read the measured temp data
* Return the measured temp data of float type, unit: C
*/
float temp = sht20.readTemperature();
// Serial.print("Time:");
// Serial.print(millis()); // Get the system time from Arduino
Serial.print(" Temperature:");
Serial.print(temp, 1); // Only print one decimal place
Serial.print("C");
Serial.print(" Humidity:");
Serial.print(humd, 1); // Only print one decimal place
Serial.print("%");
Serial.println();
delay(1000);
}

Binary file not shown.