Siksha Sarovar

Siksha Sarovar (sikshasarovar.com) is a free educational web application that helps students in India learn programming and prepare for academic and competitive exams. The platform offers structured coding courses (C, C++, Python, Java, HTML, CSS, PHP, Power BI, AI, Machine Learning, Data Science), complete university curriculum notes for BCA/MCA students with previous year question papers, Class 10 and Class 12 CBSE/HBSE school notes, and dedicated preparation material for SSC, UPSC, Banking, Railway and other government exams. Browsing the site is completely free and requires no account. Users may optionally sign in with Google solely to save their learning progress, quiz scores and personal preferences across devices.

Privacy Policy | Terms of Service | Contact Siksha Sarovar | About Siksha Sarovar

v4.0.9 · PWA
Siksha Sarovar logo
Siksha Sarovar
Your Learning Universe

Siksha Sarovar is a free e-learning platform for coding courses, BCA university notes and competitive exam preparation. Optional Google sign-in saves your learning progress across devices.

Initializing knowledge base…
Compiling modules 0%

3.7 Arduino Programming: Libraries, Emulators and Additions

Lesson 21 of 31 in the free Internet of Things (IoT) notes on Siksha Sarovar, written by Rohit Jangra.

3.7.1 The Power of Libraries

Libraries abstract the low-level bit-shifting logic (e.g., calculating I2C checksums).

  • Wire.h: Essential for I2C communication (SDA/SCL).
  • PubSubClient.h: The industry standard for MQTT on Arduino.
  • ArduinoJson.h: Critical for formatting IoT payloads into web-standard strings.
  • LiquidCrystal.h: For driving standard 16x2 LCD displays.

3.7.2 Coding Using Emulators (The Digital Twin Lab)

Emulators allow rapid prototyping without the risk of burning hardware.

  • Wokwi: Support for ESP32 and real-time networking simulation (connecting to a real MQTT broker from the browser).
  • Tinkercad: Best for visual wiring and learning basic breadboard circuits.
  • Proteus: Professional-grade PCB and Firmware co-simulation for industrial designs.

3.7.3 Programming Additions and Advanced Features

  • Interrupts: attachInterrupt(0, wakeUp, RISING). Allows the MCU to sleep and wake up only on physical events (e.g., a button press), saving 99% battery.
  • Direct Register Access: Writing PORTD = 0b11111111; for 50x faster speed than digitalWrite().
  • Watchdog Timers (WDT): A fail-safe hardware timer that resets the system if the code hangs due to a network glitch.

3.7.4 Code Efficiency Techniques for 2KB RAM

  • Use uint8_t (1 byte) instead of int (2 bytes) for small counters.
  • Use F() macro: Serial.print(F("Booting...")) to keep text strings in Flash memory instead of consuming precious SRAM.