You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: _posts/2018-03-21-trigonometry-in-p5.md
+4-1
Original file line number
Diff line number
Diff line change
@@ -3,14 +3,17 @@ layout: post
3
3
title: "Trigonometry in p5"
4
4
date: 2018-03-21 01:10:19 +0200
5
5
categories: p5 mathematics
6
+
image: 2018-03-21.jpg
6
7
language:
7
8
color: f0db4f
8
9
name: Javascript
9
10
---
11
+
Trigonometry sketch created with P5 a graphics library in JavaScript. The sketch uses trigonometry functions to translate polar coordinates to Cartesian coordinates.
12
+
<!--more-->
13
+
10
14
[P5.js](https://p5js.org/) is a graphics library for JavaScript, it is based on [Processing](https://processing.org). In the process of learning p5, I wanted to create something challenging.
11
15
12
16
Another topic I was reading about was **[Polar coordinates](https://en.wikipedia.org/wiki/Polar_coordinate_system)** and the translation to **Cartesian coordinates**. So, I decided to do something with trigonometry. The Wikipedia page might look intimidating. However, translating the coordinates between the two is just some basic math. Just check out the code below!
Copy file name to clipboardexpand all lines: _posts/2018-04-02-android-bluetooth-connection-with-arduino.md
+32-16
Original file line number
Diff line number
Diff line change
@@ -3,18 +3,35 @@ layout: post
3
3
title: "Android bluetooth connection with arduino"
4
4
date: 2018-04-02, 13:58:54 +0200
5
5
categories: android java bluetooth
6
+
image: 2018-04-02.jpg
7
+
language:
8
+
color: 8bc34a
9
+
name: Android
6
10
---
11
+
This guide describes how to communicate from Android to Arduino using bluetooth communication. It describes the process of creating an application which notifies the user if the noise level is above a certain limit. Data is gathered from a sensor on the Arduino (KY-038). Bluetooth communication with (HC-04)
12
+
<!--more-->
13
+
7
14
All of the code used in this guide can be found on the following GitHub links:
There are numerous ways to have a wireless connection between devices. One of them is bluetooth, which is actually quite easy to implement in Android. In this guide, I'll show you how to connect to a *paired* bluetooth device with the Android API.
15
32
16
33
Android has a specific API for Bluetooth connection. For in-depth information refer to their API guide [https://developer.android.com/guide/topics/connectivity/bluetooth.html](https://developer.android.com/guide/topics/connectivity/bluetooth.html)
17
-
<!--more-->
34
+
18
35
## Prerequisites
19
36
20
37
- Android device
@@ -39,7 +56,7 @@ Instead of explaining how to use bluetooth in Android, I will be explaining how
39
56
40
57
We need permissions to use bluetooth & vibrate in the application:
In `onStart` I retrieve the current threshold value from persistent storage (sharedpreference).
87
103
@@ -94,7 +110,7 @@ The user can update this preference when clicking on the `Settings` option in th
94
110
95
111
I left in the default `FloatingActionButton` which is implemented when you create a new Android application. When the button is clicked I check if bluetooth is enabled, if so select a bluetooth device to connect with, if not, enable bluetooth first.
96
112
97
-
```java
113
+
{% highlight java%}
98
114
@Override
99
115
publicvoidonClick(Viewview) {
100
116
if (mBluetoothAdapter !=null) {
@@ -110,7 +126,7 @@ public void onClick(View view) {
110
126
Toast.makeText(MainActivity.this, "Your device doesn't support bluetooth, sorry!", Toast.LENGTH_SHORT).show();
111
127
}
112
128
}
113
-
```
129
+
{% endhighlight %}
114
130
115
131
When `selectBluetoothDevice()` is run I show a dialog with the option to select a paired bluetooth device. The chosen bluetooth device is then used to communicate.
116
132
@@ -268,7 +284,7 @@ That's it for the Android part!
268
284
269
285
### Step 1 - Building the circuit
270
286
271
-

287
+

272
288
273
289
The sound sensor that I use is the KY-038 (Also called "big sound").
274
290
@@ -292,7 +308,7 @@ The bluetooth module is the HC-04. Connecting it is a little harder than the sou
292
308
293
309
Because the bluetooth module uses 3.3v for the data connection pins (RX&TX), it can't handle 5v from the Arduino. So the Arduino TX (transmit) pin which outputs 5v should be divided. This can be done with a 1K ohm resistor and a 2K ohm resistor. For specifics on wiring the HC-04 see [howtomechatronics](http://howtomechatronics.com/tutorials/arduino/arduino-and-hc-05-bluetooth-module-tutorial/).
294
310
295
-

311
+

Copy file name to clipboardexpand all lines: _posts/2018-04-27-twitter-visualization-with-processing.md
+9-2
Original file line number
Diff line number
Diff line change
@@ -3,11 +3,18 @@ layout: post
3
3
title: "Twitter visualization with Processing"
4
4
date: 2018-04-27 22:53:32 +0200
5
5
categories: twitter processing
6
+
image: 2018-04-27.jpg
7
+
language:
8
+
color: e76f00
9
+
name: Java
6
10
---
11
+
Twitter visualization of the latest trends created with the Java programming language. Created with Processing and the twitter4j library.
12
+
<!--more-->
13
+
7
14
With the Twitter4j library, you can retrieve Twitter data in the Java programming language fairly simple. In addition, the processing framework lets you create artful visualizations very easy, also with the Java language.
8
15
9
16
I wanted to combine the two, create a Twitter visualization. I choose to retrieve the newest trends from the whole world and let them slide on the window. The Twitter4j library can be found [here](http://twitter4j.org/en/index.html). And Processing [here](https://processing.org).
0 commit comments