Arduino Nano 驱动OLED测试入门(三)(SSD1306仪表盘设计)

Mixly 二次开发 自定义库 Mixly基本原理 Mixly可以看作是介于普通用户与Arduino IDE之间桥梁,通过这个桥梁,即使用户不懂C语言的语法,也可以利用图形化程序编写Arduino程序。Mixly的基本原理是将图形化程序转化成C语言,再利用Arduino IDE上传到硬件中。在我们动手编写第三方库之前,先来了解Mixly是如何将图形化程序转化成C语言的。 根目录下的xxx.xml文件定义了图形块的基本信息,比如类别、名称,ID等。block/xxx.js文件定义了每个图形块的样式,比如颜色、文字、图标等。generator 阅读详情

本来介绍如何在Nano上面,通过SSD1306设计一个仪表盘

SSD1306基本设置请参照下面的链接

Arduino Nano 驱动OLED测试入门(一)(软IIC以及硬IIC链接SSD1306屏)

SSD1306库函数参数讲解参照下面的链接

Arduino Nano 驱动OLED测试入门(二) U8glib 库函数及参数讲解

本文通过一个可调电位器,设计一个电压仪表盘。
屏的连线方式请参照入门(一),电位器三端,一端接地,一端接5V,另一端接Nano的模拟输入端A1 引脚。

在这里插入图片描述
程序中定义了三个变量,p代表AD采集的值,p的范围从0到1023,w和m分别是通过map函数重映射的值,map是一个arduino的库函数,定义为:
map(value, fromLow, fromHigh, toLow, toHigh)

value的取值范围是fromLow to fromHigh,该函数的作用是把value从一个范围变换到另一个范围。
w可以理解为百分率,p为1023的时候,w为100;
m可以理解为仪表盘指的偏转角度,初始位置为180度。

源代码参照国外例子,但源代码中关于指针角度的换算很让人费解,我重新改动了一下,更易于理解。
注释掉的部分为原代码,希望了解原作者思路的同学可以自己选择注释看一下。

p = analog read (potmeterPin); 
w = map (p, 0, 1023, 0, 100);
//m = map (p, 0, 1023, 0, 90);
m = map (p, 0, 1023, 180, 0);

程序中用到一个库函数map();
函数的作用是把

下面直接上代码,主要注意两个地方,一是确保你的Arduino IDE里已经添加了 U8glib的库文件,二是设置显示屏参数:
U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE);

/*
 Analog gauge v1.03
 - Shows half circle gauge with scale labels
 - Shows digital value, 00 - 100 aligned
 - Shows gauge label
 21/12/2015 - Rudi Imbrechts
 23/06/2020 - MGM
 http://arduinows.blogspot.com

*/
#include "U8glib.h"

U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE);  

//U8GLIB_SH1106_128X64 u8g(13, 11, 10, 9, 12); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, Res = 12
                                                // For OLED display with SH1106 driver. If you use another display, 
                                                // then please check the u8glib documentation and website at
                                                // https://github.com/olikraus/u8glib

int xmax=128;                                   // max length x-axis
int ymax=62;                                    // max length y-axis
int xcenter=xmax/2;                             // center of x-axis
int ycenter=ymax/2+10;                          // center of y-axis
int arc=ymax/2;                              
int angle=0;                                    
char* label<
Arduino Nano + SSD1306 OLED 进阶(二)( 时钟设计-带动画效果DS3231) 硬件组成 Arduino Nano 或 UNO, SSD1306 I2C总线,DS3231模块。 外加两个按键,用来设置时钟和日期,一个蜂鸣器。 根据自己的板子可以调整按键的连接位置。 本文例程使用Adafruit_SSD1306 库文件。 使用 Adafruit_SSD1306 库文件的时候,需要注意两点: 一是编译的时候可能提示如下错误: Line 53 and 54 #if (SSD1306_LCDHEIGHT != 64) and # error (“Height incorrect, plea 阅读详情

相关推荐

在Arduino给自己的SSD1306 OLED显示定制Logo或者图片

我在使用Arduino上的SSD1306显示屏时,基本都用使用Adafruit的SSD1306库,但是Adafruit的开机logo实在没特色(如下图),如果在开机时,让自己的项目上显示自己的定制logo,甚至是照片(如果你自认为很帅),有点小酷吧。通过阅读本文件,你将能自己设计简易Logo,并在你的OLED屏上显示出来。

Firmin123456的博客 3511

Arduino - OLED

oledOLED(有机发光二极管)显示器是LCD显示器的替代品。OLED超轻,几乎像纸一样薄,灵活,可产生更明亮、更清晰的图像。

acktomas的博客 2439

基于arduino设计的测温装置

红外非接触式测温嵌入式测温装置一、产品简介二、设备组成三、设备的性能指标四、模块连接五、PC端准备六、代码测试 嵌入式测温装置 一、产品简介   MLX90614 是一款红外非接触式温度计,TO-39 金属封装里同时集成了红外感应热电堆探测器芯片和信号处理专用集成芯片,可以同时测得目标温度和环境温度,测温精度高达 0.02℃。MLX90614 有 IIC 和 PWM 两种通信方式,模块上电默认为 IIC 通信模式,仅需两根线与 Arduino连接即可使用,提供 Arduino 库文件,编程简单。 二、设备组

qq_45704645的博客 7288

基于Arduino Nano与OLED屏的物理番茄钟DIY全攻略

在嵌入式开发与物联网项目中,微控制器编程和人机交互设计是核心基础。Arduino平台因其丰富的库资源和活跃的社区,成为快速原型开发的理想选择。其原理在于通过简洁的C++代码控制硬件引脚,实现传感器数据读取、执行器驱动与信息显示。掌握状态机和非阻塞编程等技术,能有效构建实时响应系统,提升项目的可靠性与用户体验。这些技术价值在于将抽象的逻辑转化为具体的物理交互,特别适用于需要直观反馈和专注环境的场景。本文以制作一个独立运行的物理番茄钟为例,深入讲解了如何利用Arduino Nano、SSD1306 OLED显示

weixin_30265103的博客 480

手把手教你用Arduino Nano点亮0.96寸OLED屏(附完整代码与接线图)

本文详细介绍了如何使用Arduino Nano连接并驱动0.96寸OLED显示屏,包括硬件接线、软件配置、基础显示程序编写及进阶功能实现。通过完整的代码示例和实用技巧,帮助初学者快速掌握OLED屏的应用,适用于各种DIY电子项目和嵌入式开发。

weixin_29189377的博客 393

Arduino Nano驱动OLED屏避坑指南:从乱码到完美显示中文

本文详细解析了Arduino Nano驱动OLED屏显示中文的完整解决方案,从乱码问题根源分析到U8g2图形库应用、自定义字模数组和外部Flash存储字库三种方案对比,并提供了中英文混排优化技巧和自定义图形动画实现方法,帮助开发者彻底解决中文显示难题。

weixin_29189373的博客 316

Arduino Nano驱动OLED屏:从I2C接线到“Hello World”实战

本文详细介绍了如何使用Arduino Nano驱动OLED显示屏,从I2C接线到显示'Hello World'的完整实战教程。涵盖硬件准备、库安装、代码详解及常见问题排查,特别适合初学者快速上手Arduino与OLED屏的开发。

weixin_33698043的博客 598

0.96寸OLED与SSD1306驱动详解:从Arduino到STM32的I2C实战

I2C是一种常见的串行通信协议,只需两根数据线即可连接多个外设,在嵌入式开发中应用广泛。SSD1306是最常用的OLED驱动芯片,它内部集成显存和电荷泵,通过I2C接口即可控制128x64像素的显示。理解SSD1306的显存组织、页地址机制和控制字节格式,是高效驱动OLED屏的基础。从Arduino快速点亮屏幕,到C51用GPIO模拟I2C时序,再到STM32使用硬件I2C外设,掌握底层协议后,即可在不同平台上灵活移植,极大提升开发效率。本文从I2C协议原理出发,结合SSD1306的初始化流程、字模制作、常

weixin_34174322的博客 403

有限元中的对称魔法:用1/6模型算整个涡轮叶片(含MATLAB代码)

本文深入解析了有限元分析中针对循环对称结构的高效求解策略。通过利用涡轮叶片等结构的几何重复性,仅需对1/6基本扇区建模并施加循环对称条件,即可精确推演整体力学行为,大幅降低计算规模。文章从数学原理推导到MATLAB代码实现,提供了完整的实战指南,适用于旋转机械的静力、模态及谐响应分析。

fire9的博客 310

EWF写保护功能详解:从安装到实战操作指南

本文详细介绍了EWF写保护功能的安装与实战操作指南。EWF(Enhanced Write Filter)通过重定向写入操作保护硬盘分区,特别适合需要长期稳定运行的系统场景。文章涵盖从安装准备、图形界面操作到命令行高级管理的全流程,并提供了常见问题的解决方案,帮助用户轻松掌握这一实用工具。

weixin_28710999的博客 446

FreeSWITCH安装指南:三种部署方式解析与实践对比

Freeswitch部署方案比较:Yum安装简单快捷但灵活性差;源码安装可定制性强,适合深度开发和性能优化;Docker部署环境一致性好但网络配置复杂。生产环境推荐源码安装以获得最佳性能和定制能力,而Docker适合快速部署和扩展。不同方案各有利弊,需根据具体需求选择。

c_zyer的博客 2138

RYU+mininet——RYU

1. 使用RYU做mininet的控制器 1.1 RYU介绍与安装 RYU是一款基于python的控制器,你可用Ryu实现各种想要实现的网络功能,它可以下发或接收流表进行各种路由运算。 建议使用高版本的Ubuntu系统安装ryu,否则会有各种错误,安装过程比较简单,如下: apt install gcc libffi-dev libssl-dev libxml2-dev libxslt1-...

qq_34415266的博客 1万+

【嵌入式Linux】EC20模块多运营商自适应PPP拨号实战:从IMSI识别到网络配置

本文详细介绍了在嵌入式Linux系统中,如何基于EC20 4G模块实现多运营商自适应PPP拨号。通过解析SIM卡的IMSI识别运营商,并动态配置对应的APN和拨号参数,结合AT指令交互与健壮的pppd脚本,解决了设备跨地域部署时的网络自动连接问题,提升了物联网设备的部署效率和稳定性。

fox11的博客 899

【笔记篇】Davinci Configurator EcuM模块

autosar ecum模块简介

weixin_47571898的博客 1268

10.Labview局部变量、全局变量、引用、属性节点、调用节点用法理解及精讲

本文的结构还是首先教大家明确概念问题,然后深入理解概念并学会使用,最后在理论基础掌握的基础上,通过实例来强化大家的理解。本文依旧是**先理论后实践**的教学方式,欢迎留言或私聊提问。

关注我,更多技术问题欢迎私聊~ 1万+

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

上一篇: 一步一步把 Arduino Nano 电路移植到自己的板子上
下一篇: Arduino Nano 驱动OLED测试入门(二) U8glib 库函数及参数讲解
malcolm_110
博客等级 码龄9年 416粉丝 45原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值