This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Flatten nested arrays of numbers into a single-dimension array of numbers | |
| // e.g. [0, 1, [2, 3, [4, 5]]] => [0, 1, 2, 3, 4, 5] | |
| class ArraySquasher { | |
| // Private method - Recursively flatten array | |
| private static recurse(arr: Array<any>): Array<number> { | |
| // Initialize result and process array | |
| var result = []; | |
| for (var i = 0, ii = arr.length; i != ii; ++i) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <SoftwareSerial.h> | |
| #include <CapacitiveSensor.h> | |
| SoftwareSerial BTserial(2, 3); // Digital pins 2 and 3 for bluetooth RX and TX | |
| CapacitiveSensor cap_sensor = CapacitiveSensor(4,8); // Digital pins 4 and 8 | |
| // Holds the current available character on the BT serial stream | |
| char bt_char = ' '; | |
| // Initialization |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: arduino_bluetooth_mobile | |
| description: Arduino bluetooth control demo app | |
| version: 1.0.0+1 | |
| environment: | |
| sdk: ">=2.2.0 <3.0.0" | |
| dependencies: | |
| flutter: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/material.dart'; | |
| import 'dart:async'; | |
| import 'bt-controller.dart'; | |
| void main() => runApp(ArduinoBT()); | |
| class ArduinoBT extends StatelessWidget { | |
| @override | |
| Widget build(BuildContext context) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/services.dart'; | |
| import 'dart:async'; | |
| class BTController { | |
| static const platform = const MethodChannel('flutter.native/helper'); | |
| static Function _onData = (String string) => { }; | |
| static init(Function onData) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.example.bt_demo; | |
| import java.io.InputStream; | |
| import java.io.OutputStream; | |
| import java.io.IOException; | |
| import java.nio.charset.Charset; | |
| import java.util.ArrayList; | |
| import java.util.HashMap; | |
| import java.util.Map; | |
| import java.util.Set; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/material.dart'; | |
| import 'demo-card.dart'; | |
| import 'items.dart'; | |
| import 'animated-bg.dart'; | |
| void main() => runApp(AnimationDemo()); | |
| class AnimationDemo extends StatelessWidget { | |
| @override |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/material.dart'; | |
| class Item { | |
| String name; | |
| String description; | |
| MaterialColor color; | |
| IconData icon; | |
| Item(this.name, this.description, this.color, this.icon); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/material.dart'; | |
| import 'items.dart'; | |
| class DemoCard extends StatelessWidget { | |
| DemoCard(this.item); | |
| final Item item; | |
| static final Shadow _shadow = Shadow(offset: Offset(2.0, 2.0), color: Colors.black26); | |
| final TextStyle _style = TextStyle(color: Colors.white70, shadows: [_shadow]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/material.dart'; | |
| import 'dart:math' as math; | |
| class AnimatedBackground extends StatefulWidget { | |
| AnimatedBackground({Key key, this.controller}) : super(key: key); | |
| final ScrollController controller; | |
| @override |
OlderNewer