Posts

Showing posts with the label Programming

显示代码片段 / Display Code Snippet In Blogger

Image
很多时候我们可以在网络教学里可以看到作者都会有显示代码片段, 比如以下: 这也是我很久之前就好奇如何办到的,所以我今天就来研究如何显示代码片段。 方式: 截图 Screenshot 这方式很简单,快速,可惜不太方便读者因为不能 highlight code Example of Code Snippet:  Edit HTML & CSS 自己加 CSS style sheet 和加 Html tag 好处:可以自己 customize 设计,颜色等 坏处:费时,不是一个很好的方法 所以以下是我下午自己做的成品例子: #include <SPI.h> #include <Ethernet.h> // the media access control (ethernet hardware) address for the shield: byte mac[] = { 0xDE , 0xAD , 0xBE , 0xEF , 0xFE , 0xED }; //the IP address for the shield: byte ip[] = { 192 , 168 , 66 , 100 }; EthernetServer server = EthernetServer( 111 ) ; void setup() { Ethernet . begin( mac , ip ) ; } void loop() { // if an incoming client connects, there will be bytes available to read: EthernetClient client = server. available() ; if (client == true ) { // r...

Espressif ESP32 TCP/IP

还记得在大学时期,我上Networking课的时候,还是大一的时候。给我们上那堂课的教授是个好老师,可惜我对这门科的兴趣视乎不大,也不懂考试怎样过的😂4年后的我想说,我把知识还给教授了。 怎么今天说到他呢?原因是工作啦。最新的一个任务就是Enhance之前人做的result。刚好,之前那位用了TCP/IP ( Transmission Control Protocol/Internet Protocol) communication protocol. 当我一听到这个的时候,我心想,啊!这个!我懂名字而已哈哈。概念是什么我也不清楚。战战兢兢的找了一些影片来看,想说就换个IP (Internet Protocol) address就好吧。 怎知,看到之前的人做的代码,我蒙了,怎么需要MAC address, DNS server, Default Gateway? 脑里一堆问号。当然这些Terms对我来说并不陌生,我认识他们但不是很明白他们。自己研究尝试了整个上午,发现不行了,我需要向人求救了。果然同事Senior就是厉害,他问我“你有学过Networking?”, 我弱弱回复“有,不过很久很久之前的事情了”。当时的我觉得好羞耻,对不起我把大学的面子给毁掉了哈哈哈哈。(PS:这真的不是我的强项,我会继续加油的,哈哈。 顿时想当一只鸵鸟,把头往土里埋,多好。)PPS:你们就继续笑我吧,咳咳。 最后发现是自己把自己给搞乱了。原理很简单,我也和大家简单介绍吧。Device和Device之间要讲话/交换讯息需要通过一个Server嘛。所以,要怎样和Server沟通? 我们需要地址,地址就是IP address。可是这地址是个公寓有很多间家,所以我们需要门牌号。我们的门牌号就是 Port Number 啦。而MAC address 也被称为Physical address 就是所谓的身份证号码,是独特的Unique的。 根据以上的情况: Server --- Espressif ESP32 (A micro-controller) PortNumber --- 111(自己给他一个号码吧,一共有3类Port ,有机会我再另外做个笔记😛) ...

Arduino IDE Bug (Keep Minimized)

Image
Sunday night, just planned to view my sketches before next day of working. Suddenly realize that my Arduino IDE always open in minimized mode and does not able to view IDE windows. Luckily, I found some workable solution from Arduino's Forum and the solutions work. I will summaries the workable solution below. Screenshot of my desktop when opening Arduino.exe: It just opened successfully in minimize mode and not able to view IDE windows. Solutions: Go to:  C:/Users/< your_username >/AppData/Local Rename the "Arduino15" folder to "Arduino15.bak" Restart your Arduino.exe It will automatically create a new Default Arduino15 folder If you have any downloaded package, you can just copy paste into the new Arduino15 folder. If it is a third party packages. Remember to add the package's URLs back to your File > Preferences  so you are not required to reinstall the packages again. While you restart the Arduino.exe, you are suppose to see the your packages i...