GPIO是什么?

const long timeoutTime = 2000;

void setup() {

Serial.begin(115200);

// Initialize the output variables as outputs

pinMode(output5, OUTPUT);

pinMode(output4, OUTPUT);

// Set outputs to LOW

digitalWrite(output5, LOW);

digitalWrite(output4, LOW);

// Connect to Wi-Fi network with SSID and password

Serial.print("Connecting to ");

Serial.println(ssid);

WiFi.begin(ssid, password);

while (WiFi.status() != WL_CONNECTED) {

delay(500);

Serial.print(“.”);

}

// Print local IP address and start web server

Serial.println(“”);

Serial.println(“WiFi connected.”);

Serial.println("IP address: ");

Serial.println(WiFi.localIP());

server.begin();

}

void loop(){

WiFiClient client = server.available(); // Listen for incoming clients

if (client) { // If a new client connects,

Serial.println(“New Client.”); // print a message out in the serial port

String currentLine = “”; // make a String to hold incoming data from the client

currentTime = millis();

previousTime = currentTime;

while (client.connected() && currentTime - previousTime <= timeoutTime) { // loop while the client’s connected

currentTime = millis();

if (client.available()) { // if there’s bytes to read from the client,

char c = client.read(); // read a byte, then

Serial.write©; // print it out the serial monitor

header += c;

if (c == ‘\n’) { // if the byte is a newline character

// if the current line is blank, you got two newline characters in a row.

// that’s the end of the client HTTP request, so send a response:

if (currentLine.length() == 0) {

// HTTP headers always start with a response code (e.g. HTTP/1.1 200 OK)

// and a content-type so the client knows what’s coming, then a blank line:

// 拼接HTTP协议回复

client.println(“HTTP/1.1 200 OK”);

client.println(“Content-type:text/html”);

client.println(“Connection: close”);

client.println();

// turns the GPIOs on and off

if (header.indexOf(“GET /5/on”) >= 0) {

Serial.println(“GPIO 5 on”);

output5State = “on”;

digitalWrite(output5, HIGH);

} else if (header.indexOf(“GET /5/off”) >= 0) {

Serial.println(“GPIO 5 off”);

output5State = “off”;

digitalWrite(output5, LOW);

} else if (header.indexOf(“GET /4/on”) >= 0) {

Serial.println(“GPIO 4 on”);

output4State = “on”;

digitalWrite(output4, HIGH);

} else if (header.indexOf(“GET /4/off”) >= 0) {

Serial.println(“GPIO 4 off”);

output4State = “off”;

digitalWrite(output4, LOW);

}

// Display the HTML web page

client.println(“”);

client.println(“<meta name=“viewport” content=“width=device-width, initial-scale=1”>”);

client.println(“<link rel=“icon” href=“data:,”>”);

// CSS to style the on/off buttons

// Feel free to change the background-color and font-size attributes to fit your preferences

client.println(“

client.println(“.button { background-color: #195B6A; border: none; color: white; padding: 16px 40px;”);

client.println(“text-decoration: none; font-size: 30px; margin: 2px; cursor: pointer;}”);

client.println(“.button2 {background-color: #77878A;}”);

// Web Page Heading

client.println(“

ESP8266 Web Server

”);

// Display current state, and ON/OFF buttons for GPIO 5

client.println("

GPIO 5 - State " + output5State + “

”);

// If the output5State is off, it displays the ON button

if (output5State==“off”) {

client.println(“

<a href=”/5/on"><button class=“button”>ON

");

} else {

client.println(“

<a href=”/5/off"><button class=“button button2”>OFF

");

}

// Display current state, and ON/OFF buttons for GPIO 4

client.println("

GPIO 4 - State " + output4State + “

”);

// If the output4State is off, it displays the ON button

if (output4State==“off”) {

client.println(“

<a href=”/4/on"><button class=“button”>ON

");

} else {

client.println(“

<a href=”/4/off"><button class=“button button2”>OFF

");

}

client.println(“”);

// The HTTP response ends with another blank line

client.println();

// Break out of the while loop

break;

自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。

深知大多数Java工程师,想要提升技能,往往是自己摸索成长或者是报班学习,但对于培训机构动则几千的学费,着实压力不小。自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!

因此收集整理了一份《2024年Java开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。img

既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上Java开发知识点,真正体系化!

由于文件比较大,这里只是将部分目录截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且会持续更新!

如果你觉得这些内容对你有帮助,可以扫码获取!!(备注:Java)

2021年Java中高级面试必备知识点总结

在这个部分总结了2019年到目前为止Java常见面试问题,取其面试核心编写成这份文档笔记,从中分析面试官的心理,摸清面试官的“套路”,可以说搞定90%以上的Java中高级面试没一点难度。

本节总结的内容涵盖了:消息队列、Redis缓存、分库分表、读写分离、设计高并发系统、分布式系统、高可用系统、SpringCloud微服务架构等一系列互联网主流高级技术的知识点。

目录:

(上述只是一个整体目录大纲,每个点里面都有如下所示的详细内容,从面试问题——分析面试官心理——剖析面试题——完美解答的一个过程)

部分内容:

对于每一个做技术的来说,学习是不能停止的,小编把2019年到目前为止Java的核心知识提炼出来了,无论你现在是处于什么阶段,如你所见,这份文档的内容无论是对于你找面试工作还是提升技术广度深度都是完美的。

不想被后浪淘汰的话,赶紧搞起来吧,高清完整版一共是888页,需要的话可以点赞+关注
《互联网大厂面试真题解析、进阶开发核心学习笔记、全套讲解视频、实战项目源码讲义》点击传送门即可获取!
术的来说,学习是不能停止的,小编把2019年到目前为止Java的核心知识提炼出来了,无论你现在是处于什么阶段,如你所见,这份文档的内容无论是对于你找面试工作还是提升技术广度深度都是完美的。

不想被后浪淘汰的话,赶紧搞起来吧,高清完整版一共是888页,需要的话可以点赞+关注
《互联网大厂面试真题解析、进阶开发核心学习笔记、全套讲解视频、实战项目源码讲义》点击传送门即可获取!

  • 16
    点赞
  • 29
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
S3C2440是一款嵌入式处理器,它的GPIO、UART和Watchdog是它的三个重要外设。下面我来分别介绍一下: 1. GPIO GPIO是General Purpose Input/Output的缩写,即通用输入输出端口。S3C2440共有7组GPIO,每组可以控制多个IO口。通过编程设置,可以将GPIO口设置为输入或输出,并且可以设置GPIO口的电平状态。GPIO口可以用于与外部设备进行数据交互,比如连接LED、按钮、LCD等。 使用方法: a. 选择要使用的GPIO口,将其配置为输入或输出。 b. 如果是输出,可以设置GPIO口的电平状态,使其输出高电平或低电平。 c. 如果是输入,可以读取GPIO口的电平状态,获取外部设备的状态信息。 2. UART UART是Universal Asynchronous Receiver/Transmitter的缩写,即通用异步收发器。S3C2440共有3个UART,用于串口通信。UART可以将数据从一个设备传输到另一个设备,数据传输方式为异步传输,即不需要时钟信号进行同步。 使用方法: a. 配置UART的波特率、数据位、停止位等参数。 b. 设置UART的发送和接收缓冲区。 c. 发送数据时,将数据写入发送缓冲区,等待发送完成。 d. 接收数据时,等待数据到达接收缓冲区,读取数据并处理。 3. Watchdog Watchdog是一种硬件定时器,用于检测系统是否正常运行。S3C2440的Watchdog可以被程序写入一个计数值,当计数器到达设定值时,Watchdog会自动重启系统。如果系统出现异常情况导致程序死循环或死机,Watchdog会在设定的时间内自动重启系统。 使用方法: a. 配置Watchdog的计数值和定时器参数。 b. 启动Watchdog,使其开始计时。 c. 定期喂狗,即在程序中定时重置Watchdog的计数器,防止Watchdog超时导致系统重启。 需要注意的是,Watchdog不能随意重置,否则可能会导致系统不稳定。重置Watchdog的时间间隔应该小于Watchdog的计时时间,通常为1/3或1/2。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值