Block coding application utilizing ADDI blocks
Connect Addi blocks via Bluetooth.
Then, perform block coding and execute it to see the ADDI blocks operate in real-time.
240201~ , KIST_Creamo
| Members |
|---|
| Seungyeon JI |
| Heeyun HEO |
| Jiwoo BYUN |
- IDE: Android Studio 2022.3.1.21
- Flutter SDK: 3.16.8
flutter run lib/main.dart
** Connection Block**
When the user drags and drops Connection Block 1, Connection Block 2 is automatically created below it. Even if these two blocks appear separate on the screen, the server recognizes them as connected.
** Repeat Block**
The blocks following the Repeat Block are repeated on the server according to the number specified in the Repeat Count Block located at the end of the loop.
** Speaker Block**
When the user executes the Speaker Block and the Speaker On Block, sound is produced from the actual block.
** Motor Block**
When the user executes the Motor Block and the Direction Block, the actual block moves.
** LED Block**
When the user executes the LED Block and the Color Block, the actual block lights up.
** Image Block**
When the user executes the Image Block, a specific shape appears on the actual block.
main.dart
- The file that runs the application.
splash_page.dart
- This is the initial screen where Addi AI coding is executed.
start_page.dart
- The page is for choosing between "Getting Started" and "How to Use."
content_page.dart
- You can check the quiz table of contents and select a quiz from here.
puzzle_page.dart
- Initialization
- The widget initializes with a given image path for the puzzle.
- Scrolling Interface
- It provides a horizontally scrollable interface divided into sections. The user can scroll through different sections using buttons.
- Image Drag and Drop
- Users can drag and drop images onto a target area. The dropped images can snap to specific positions based on predefined snap points.
- Reset Functionality
- There's a reset button to clear all dropped images and reset the puzzle.
- Bluetooth Integration
- It includes a button to trigger a Bluetooth scan, and another button to initiate a puzzle-solving process which involves generating a sequence of connected block numbers.
- Trash Can Feature
- Users can drag images to a trash can area to delete them from the puzzle.
- Image Snap and Connect
- Images can snap to each other when placed close enough, forming connections. This functionality is crucial for solving the puzzle.
- Bluetooth Data Transmission
- Upon solving the puzzle, the connected block numbers are formatted and sent via Bluetooth.
bluetooth_helper.dart
- Bluetooth Device Management
- connectedDevice: Represents the currently connected Bluetooth device.
- devices: A list to store available Bluetooth devices discovered during scanning.
- Bluetooth Scanning
- startBluetoothScan(BuildContext context): Initiates the Bluetooth scan process and handles device discovery.
- _startInitialScanAndShowDevicesDialog(BuildContext context): Starts the initial Bluetooth scan and displays a dialog showing scanning progress.
- _showDevicesDialog(BuildContext context): Shows a dialog with a list of discovered Bluetooth devices, allowing the user to connect to a selected device.
- Device Connection
- _disconnectDevice(BuildContext context): Disconnects the currently connected device.
- sendData(String data): Sends data to the connected Bluetooth device.
- Dialogs and Feedback
- _showConnectedDeviceDialog(BuildContext context): Displays information about the currently connected device.
- Feedback through toast messages: Provides feedback to the user regarding connection status and operations (success or failure) using Fluttertoast.
- Permission Handling
- Requests and handles location permission to enable Bluetooth scanning.
- Event Handling
- Subscribes to Bluetooth scan results and stops scanning after a specified timeout.
- Handles user interactions such as selecting a device to connect to.
- Service Discovery and Data Transmission
- Discovers services and characteristics of the connected Bluetooth device.
- Writes data to a writable characteristic of the connected device for data transmission.
