Skip to content

Commit

Permalink
OK
Browse files Browse the repository at this point in the history
  • Loading branch information
Vida Wang authored and Vida Wang committed Aug 30, 2022
0 parents commit 188761a
Show file tree
Hide file tree
Showing 109 changed files with 18,303 additions and 0 deletions.
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

95 changes: 95 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Abc

### A basic esp32 library for beginners(Beta)

[中文](https://github.com/vidalouiswang/Abc/blob/main/README_CN.md)

This library work with Espressif offical framework esp32-arduino 2.0.3.
Only had tested on esp32 dev module.

This library is for those men who wants to code themselves but they don't have too much code skills or they are beginners, then you could start from here to learn how to program esp32.

# How to use

First you need to have a VPS, node.js 16 required.
Or you could use your PC or NAS as a server.

### Clone

```console
git clone https://github.com/vidalouiswang/Abc.git
```

### Upload

/server/
- pro/
- index.html
- ab.js
- hash.js
- create.js
- iot.js

five files to your server.
(These 5 files should be placed in the same directory, the tree only tells you which 5 files should be upload)

### Then run

```console
npm install ws
```

```console
npm install pm2
```

```console
pm2 start iot.js
```

### Local

1. Use Platform IO open root folder.
2. Locate to /src/app/ .
3. Edit app.h and app.cpp.
4. Compile and upload firmware(better erase flash first).
5. Use PC or phone connect to esp32 access point, attention, some phone you need to select "keep connection without internet".
6. Open browser,locate to http://192.168.8.1.
7. Set arguments and click reboot.
8. Locate to http://your_domain_or_ip_of_your_server:port/, 80 or 443 could be omit.
9. Now you could see your device online, click "@" could access built-in providers.

More information and examples refer to /examples/.

### Check header files for basic information, configs locate to /lib/config/config.h

### The LittleFS extra component auto-selection feature has not been tested on Windows, but it should work and currently works fine on macOS 12.5.

### More tutorials and documentation are in the works

# Thanks to

Thanks to the entire staff of Espressif, we have a cheap and easy-to-use ESP32 and other chips.
Thanks to all the developers of Node.js, we have a convenient and easy-to-use JavaScript runtime.
Thanks to all the developers of VSCode and Platform IO, we have an easy-to-use integrated development environment.

[Espressif](https://github.com/espressif)

[Node.js](https://github.com/nodejs)

[Visual Studio Code](https://github.com/microsoft/vscode)

[Platform IO](https://github.com/platformio)

[Brix](https://github.com/brix/crypto-js)

[Felix Biego](https://github.com/fbiego/ESP32Time)

# License

(GNU General Public License v3.0 License)

Copyright 2022, Vida Wang <[email protected]>

Children are the future of mankind, but there are still many children who are enduring hunger all over the world at this moment. If you are a good person and you like this lib, please donate to UNICEF.
https://unicef.org
94 changes: 94 additions & 0 deletions README_CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Abc

### 一个为新手打造的 esp32 基础库(Beta)

这个库和乐鑫官方 esp32-arduino 2.0.3 库一起使用。
仅在 esp32 完成测试。

这个库是为了那些想要自己编写代码,但是却又没有太多基础的新手打造的,这个库可以成为你学习 esp32 的起点。

# 如何使用

首先你需要有一台 VPS,安装了 node.js 16。
或者你也可以用你的电脑或 NAS 当做服务器。

### 克隆

```console
git clone https://github.com/vidalouiswang/Abc.git
```

### 上传

/server/
- pro/
- index.html
- ab.js
- hash.js
- create.js
- iot.js

这五个文件到你的服务器。
(这5个文件应该放在同一个目录,文件树只是告诉你应该上传哪5个文件)

### 然后执行命令

```console
npm install ws
```

```console
npm install pm2
```

```console
pm2 start iot.js
```

### 本地

1. 使用 Platform IO 打开根目录。
2. 定位到 /src/app。
3. 然后编辑 app.h 和 app.cpp。
4. 编译上传固件(最好先格式化flash)。
5. 使用电脑或手机搜索esp32热点,然后连接,注意,某些手机需要手动选择 “在无互联网的情况下连接” 才能正确使用。
6. 打开浏览器,进入 http://192.168.8.1。
7. 设置参数然后点击重启。
8. 打开 http://你的服务器ip或域名:端口/,用80或443可以省略。
9. 你应该可以看到在线的设备了,点击设备名称右边的 "@" 可以访问内置Provider。


更多信息和示例请参考 /examples/。

### 参考头文件查看基础信息,配置在 /lib/config/config.h。

### LittleFS 额外组件自动选择功能还未在Windows环境测试过,但是它应该可以工作,目前在macOS 12.5工作正常。

### 更多教程和文档正在编写中

# 感谢

感谢乐鑫的全体工作人员,让我们拥有了便宜好用的ESP32以及其他芯片。
感谢Node.js的全体开发者,让我们拥有了便捷好用的JavaScript运行时。
感谢VSCode和Platform IO的全体开发者,让我们拥有了好用的集成开发环境。

[Espressif](https://github.com/espressif)

[Node.js](https://github.com/nodejs)

[Visual Studio Code](https://github.com/microsoft/vscode)

[Platform IO](https://github.com/platformio)

[Brix](https://github.com/brix/crypto-js)

[Felix Biego](https://github.com/fbiego/ESP32Time)

# 协议

(GNU General Public License v3.0 License)

Copyright 2022, Vida Wang <[email protected]>

孩子是人类的未来,但是现在全世界仍然有许多孩子饱受饥饿,如果你是个善良的人、认可我的代码,请捐助联合国儿童基金会,谢谢。
https://unicef.cn
7 changes: 7 additions & 0 deletions ap/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
This folder contains files for AP mode web server.
You can modify apIndex.html and main.js, and then minify them into xxx.min.js.
Before you build firmware, the script will combine js and html into out.html and out.txt, and replace it to globalmanager.h.

这个文件夹包含了AP模式前端使用的文件。
你可以修改apIndex.html和main.js,然后把它们精简到 xxx.min.js。
在你构建固件的时候脚本会合成 js 和 html 到 out.html 和 out.txt,然后替换globalmanager.h中的内容。
1 change: 1 addition & 0 deletions ap/ab.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

126 changes: 126 additions & 0 deletions ap/apIndex.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
<!DOCTYPE html>
<html>

<head>
<title>Abc</title>
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta charset="utf-8" />
<style>
.divMain {
position: fixed;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
padding: 0.3rem;
text-align: center;
}

input {
text-align: center;
font-size: 1.1rem;
margin: 0.3rem;
}

.btn {
font-size: 1.1rem;
text-decoration: none;
color: #000;
border: 0.1rem solid #000;
border-radius: 0.1rem;
margin: 0.3rem;
padding: 0.2rem;
display: inline-block;
}

.btn:hover {
background: lightskyblue;
border-radius: 0;
}

.msg {
position: fixed;
width: 100vw;
left: 0;
padding: 0.3rem;
background: rgb(0, 91, 134);
color: #fff;
text-align: center;
top: -100%;
font-size: 1.1rem;
transition: all 0.9s ease-in-out;
}

.msgShow {
top: 0;
}
</style>
</head>

<body>
<div id="msg" class="msg"></div>
<div class='divMain'>
<div>
<div>
<input id='ssid' type='text' />
</div>
<div>
<input id='wifiPwd' type='password' />
</div>
</div>
<div>
<div>
<input id='user' type='text' />
</div>
<div>
<input id='userPwd' type='password' />
</div>
</div>
<div>
<div>
<input id='websocketDomain' type='text' />
</div>
<div>
<input id='websocketPort' type='text' />
</div>
<div>
<input id='websocketPath' type='text' />
</div>
</div>
<div>
<div>
<input id='nickname' type='text' />
</div>
<div>
<input id='token' type='password' />
</div>
</div>
<div>
<div>
<a class='btn' id='setArguments'></a>
</div>
<div>
<a class='btn' id='reboot'></a>
</div>
<div>
<a class='btn' id='rebootNow'></a>
</div>
<div>
<a class='btn' id='rollback'></a>
</div>
<div>
<a class='btn' id='deepSleep'></a>
</div>
</div>
</div>
<script>
ab_js
</script>
<script>
hash_js
</script>
<script>
main_js
</script>
</body>

</html>
1 change: 1 addition & 0 deletions ap/hash.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions ap/hash.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 188761a

Please sign in to comment.