This repository demonstrates a simple Arduino project that toggles an LED on pin 13 using a push‑button on pin 2. The Arduino sketch lives in the arduino/ folder. Additionally, the repository includes a Flutter mobile app that communicates with the Arduino over Bluetooth to display and control the LED state.
| Layer | Technology | Why It’s Chosen |
|---|---|---|
| UI | Flutter (v3.x) | Single code‑base for iOS, Android, and desktop; fast hot‑reload; expressive widget library. |
| Language | Dart | Ahead‑of‑time compiled, strong typing, easy interop with platform channels. |
| Communication | Bluetooth Low Energy (BLE) via flutter_blue (or Serial over USB using usb_serial) |
Low‑latency, wireless control of Arduino peripherals. |
| Firmware | Arduino IDE (C/C++) | Direct hardware access; extensive library ecosystem. |
| Build System | Flutter CLI (flutter run, flutter build apk) |
Simple, reproducible builds. |
├─ arduino/ # Arduino sketch and wiring guide (unchanged)
│ ├─ src/ # .ino files
│ └─ README.md # Optional Arduino‑specific notes
├─ lib/ # Flutter source code (Dart)
│ └─ main.dart # Entry point & UI implementation
├─ pubspec.yaml # Flutter dependencies
└─ README.md # (this file)
All Arduino source files are located in the arduino/ folder. Open them directly in the Arduino IDE:
- Open
arduino/src/<your_sketch>.ino. - Verify board/port settings.
- Click Upload to flash the firmware.
Note: The sketch already implements a simple BLE UART service that receives commands (
LED_ON,LED_OFF, etc.) from the Flutter app.
- Flutter SDK (≥3.0) installed and added to PATH.
- Android Studio / Xcode (for device emulation) or a physical device.
- Bluetooth permissions set in
android/app/src/main/AndroidManifest.xmlandInfo.plistfor iOS.
# Get dependencies
flutter pub get
# Run on a connected device (Android / iOS)
flutter runThe app displays a Toggle LED button. When pressed, it sends the appropriate BLE command to the Arduino. The UI updates in real‑time thanks to Flutter's reactive framework.
- Flash the Arduino using the steps above.
- Start the Flutter app on your phone or emulator.
- Pair with the Arduino (it appears as a BLE device named "Arduino_LED"). The app automatically scans and connects.
- Press Toggle LED – the LED on the Arduino board will turn on/off.
- Add more sensors (e.g., temperature, distance) and expose new BLE commands.
- Expand the Flutter UI with charts, settings screens, or multi‑device management.
- Replace BLE with Wi‑Fi (using ESP‑8266/ESP‑32) and adjust the Flutter side to use TCP sockets.
This project is released under the MIT License. Feel free to modify, distribute, and use it in personal or commercial projects.
Generated by Antigravity AI