- 博客(1)
- 资源 (2)
- 收藏
- 关注
原创 解决UOS系统设置不显示有线网络的问题
4. sudo touch /etc/NetworkManager/conf.d/10-globally-managed-devices.conf (一定是10-globally-managed-devices.conf这个名字,不能乱改,我就吃亏了!由于图形界面使用的是 network-manager,所以需要修改重启。然后再看图形界面setting里面就有网卡了。如果没有重启一下机器。连接网络,重启后提醒更新设置,更新后重启即可。(把false改成true)
2023-06-02 17:25:10
2880
3
SqlLite/Mysql/Oracle 数据库连接、增删改查基本操作python使用全
SqlLite/Mysql/Oracle数据库基于pycharm连接、增删改查基本操作python使用全
# 1连接数据库 2 拿到游标 3 执行sql 4关闭游标 5关闭数据库
import _sqlite3
# 连接
conn = _sqlite3.connect('test.db')
#拿到游标
cursor = conn.cursor()
#执行sql
sql = "create table user (id int(11) primary key, name varchar(50))"
cursor.execute(sql)
#关闭游标和连接
cursor.close()
conn.close()
2023-04-21
PM2.5_wifi.zip
PM2.5检测实现,WiFi模块esp8266实现:
#include "esp8266.h"
#include "pm.h"
char Cache[40];
char Result[2];
char data*data wifi="2021";
char data*data wifiword="20212021";
char data*data TCP="183.230.40.40";
char data*data TCP_port="1811";
char data*data key="*251177#test#test*";
int state;
int state_OK=1;
int i=0; //计数
void Wifi_state(int state1){
switch(state1){
case 0: Wifi_Com("AT+CWMODE=1");Wifi_OK();break;
case 1: Wifi_Com("AT+RST");Wifi_OK();break;
case 2: Wifi_Com("AT+CIPMUX=0");Wifi_OK();break;
case 3: Wifi_Hotspot(wifi,wifiword);Wifi_OK();break;
case 4: Wifi_Com("AT+CIPMODE=1");Wifi_OK();break;
case 5: Wifi_Tcp(TCP,TCP_port);Wifi_OK();break;
case 6: Wifi_Com("AT+CIPSEND");delayms(2000);Wifi_dat(key);delayms(5000);state++;break;
}
if(state<7){
Wifi_state(state);
}else{
if(state==7){
Wifi_dat("+++");delayms(1000);Wifi_Com("AT+CIPSEND");delayms(2000);Wifi_dat(30);delayms(2000);Wifi_dat(30);delayms(5000);
}
return;
}
}
void Wifi_OK(){ //判断OK
unsigned long int i=0;
while(state_OK){
i++;
if(i==1000000){
state=0;
return;
}
}
state_OK=1;
state++;
}
void Wifi_dat(char* dat){
send(dat);
}
void Wifi_Tcp(char* TCP,char* TCP_port){ //连接TCP
sprintf((char*)Cache,"AT+CIPSTART=\"TCP\",\"%s\",%s",TCP,TCP_port);
send(Cache);
send("\r\n");
Cache_clear();
}
void Wifi_Hotspot(char* wifi,char* wifiword){ //连接WIFI
delayms(2000);
sprintf((char*)Cache,"AT+CWJAP=\"%s\",\"%s\"",wifi,wifiword);
send(Cache);
send("\r\n");
Cache_clear();
}
void Wifi_Com(char* Com){ //发送命令
sprintf((char*)Cache,"%s",Com);
send(Cache);
send("\r\n");
Cache_clear();
}
void Cache_clear(){
int j;
for(j=0;j<40;j++){
Cache[j]=0;
}
}
void sbu() interrupt 4{
uchar num;
if(RI==0) return;
ES=0;
RI=0;
num=SBUF;
Result[i]=num;
i=(i+1)%2;
if((num=='K')&&(Result[i]=='O')){ //OK, i=K i-1=O; 0=O 1=K 0=K 1=O
state_OK=0;
}
ES=1;
}
void send(uchar *p){
int i=0;
do{
SBUF=p[i++];
while(TI==0);
TI=0;
}
while(p[i]!=0);
}
void UartInit(void) //115200bps@11.0592MHz
{
SCON = 0x50; //8位数据,可变波特率
AUXR |= 0x40; //定时器1时钟为Fosc,即1T
AUXR &= 0xFE; //串口1选择定时器1为波特率发生器
TMOD &= 0x0F; //设定定时器1为16位自动重装方式
TL1 = 0xE8; //设定定时初值
TH1 = 0xFF; //设定定时初值
ET1 = 0; //禁止定时器1中断
TR1 = 1; //启动定时器1
}
2019-12-17
dzc_m终.zip
全国电赛电子秤代码:
主函数代码如下
#include <stc15f2k60s2.h>
#include "hx711.h"
#include <stdio.h>
#include "delay.h"
#include "show.h"
#include "key.h"
double num,package,n;
double danjia=0.0,money,factweight;
int i;
bit start=0,flag_D=0,judge_qupi=0;
char xdata d[4];
char xdata danjia_z[5];
void dat_rm(char *p){
char j;
for(j=0;j<4;j++){
p[j]=0;
}
}
void danjia_rm(){ //存储单价的数组初始化
int i;
for(i=0;i<6;i++){
danjia_z[i]=0;
}
}
void clear() //将变量置零
{
num_k=16;
b=0;
judge_qupi=0;
start=0;
i=0;
n=0;
end=0;
}
void show_num_init() //数值显示初始化
{
num=0.0;danjia=0.0;money=0.0;package=0.0;factweight=0.0;
dsp_single_colour(WHITE);
show_c();
sprintf(d,"%2.2f",num);
Display_ASCII8X16_Color(45,10,d,BLACK,WHITE);
dat_rm(d);
sprintf(d,"%2.2f",danjia);
Display_ASCII8X16_Color(45,25,d,BLACK,WHITE);
dat_rm(d);
sprintf(d,"%2.2f",money);
Display_ASCII8X16_Color(45,43,d,BLACK,WHITE);
dat_rm(d);
sprintf(d,"%2.2f",package);
Display_ASCII8X16_Color(45,61,d,BLACK,WHITE);
dat_rm(d);
sprintf(d,"%2.2f",factweight);
Display_ASCII8X16_Color(45,79,d,BLACK,WHITE);
dat_rm(d);
}
void input_DJ() //单价输入及显示
{
if(num_k==13)
{
if(start==0)
{
start=1;
i=0;
while(start)
{
while(b!=1)
keyscan16();
if(b==1)
{
b=0;
if(end==1)
{
end=0;
break;
}
else if(end==2)
{
end=0;
danjia_z[i++]=num_k;
}
n=i;
}
sprintf(d,"%0.2f",n); //判断输入单价的位数
Display_ASCII8X16_Color(40,115,d,BLACK,WHITE);
}
if(n==1) //单价的精确度保留小数点后1位或2位 0.0-999.9
danjia=danjia_z[0];
if(n==2)
danjia=danjia_z[1]*10+danjia_z[0];
if(n==3)
if(danjia_z[1]==12)
danjia=danjia_z[0]+danjia_z[2]*0.1;
else
danjia=danjia_z[0]*100+danjia_z[1]*10+danjia_z[0];
if(n==4)
{
if(danjia_z[1]==12)
danjia=danjia_z[0]+danjia_z[2]*0.1+danjia_z[3]*0.01;
if(danjia_z[2]==12)
danjia=danjia_z[0]*10+danjia_z[1]+danjia_z[3]*0.1;
}
if(n==5)
{
if(danjia_z[2]==12)
danjia=danjia_z[0]*10+danjia_z[1]+danjia_z[3]*0.1+danjia_z[4]*0.01;
if(danjia_z[3]==12)
danjia=danjia_z[0]*100+danjia_z[1]*10+danjia_z[2]+danjia_z[2]*0.1+danjia_z[4]*0.01;
}
flag_D=1;
n=0;
}
else if(start==1)
{
start=0;
// danjia=12.5;
sprintf(d,"%2.2f",danjia);
Display_ASCII8X16_Color(45,25,d,BLACK,WHITE);
dat_rm(d);
danjia_rm();
num_k=16;
}
}
}
void output_money() //金额显示
{
if(num_k==11&&flag_D==1)
{
money=danjia*num;
sprintf(d,"%2.2f",money);
Display_ASCII8X16_Color(45,43,d,BLACK,WHITE);
dat_rm(d);
}
}
void qupi() //去皮
{
if(num_k==10)
{
judge_qupi=1;
package=ReadKg(12.4384,686020.400);
sprintf(d,"%2.2f",package);
Display_ASCII8X16_Color(45,61,d,BLACK,WHITE);
dat_rm(d);
factweight=num-package;
sprintf(d,"%2.2f",factweight);
Display_ASCII8X16_Color(45,79,d,BLACK,WHITE);
dat_rm(d);
}
}
void init_num() //刷新页面
{
if(num_k==15)
{
clear();
show_num_init();
}
}
void main(){
P3M0=0;P3M1=0; //键盘初始化
lcd_initial();
show_c();
show_num_init();
while(1){
if(judge_qupi==0) //去皮标志判断
{
num=ReadKg(12.4384,686020.400);
if(num<0)
num=0;
sprintf(d,"%2.2f",num);
Display_ASCII8X16_Color(45,10,d,BLACK,WHITE);
dat_rm(d);
}
keyscan16(); //按键扫描
input_DJ(); //调用输入单价函数
output_money(); //调用显示金额函数
qupi(); //调用去皮函数
init_num(); //调用初始化数值
}
}
2019-12-17
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人