Gunnewiek.com

Arduino Basics 2: Potentiometers, Buttons and Switches

Some basic user controls that you will find on almost any electronic device include buttons, switches and potentiometers. These are used in almost any electronic system that requires user input of any kind. I have covered how to use each of these inputs and how to use them to control LEDs or just gather their data.

Continue reading Arduino Basics 2: Potentiometers, Buttons and Switches

Open .pde files with Arduino IDE in Linux

After I installed the Arduino IDE I found out that I could not run "arduino test.pde" to open an existing sketch. The previous command would just open a blank sketch.

To fix this problem you have to edit the Arduino startup script, which in my case is located at "/usr/share/arduino/arduino". The last line of this file looks like this:

java -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel processing.app.Base

and it needs to be changed to this:

java -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel processing.app.Base "$*"

Finally I had to change my "/usr/bin/arduino" from:

/usr/share/arduino/arduino

to

/usr/share/arduino/arduino "$*"

Now you should be able to associate .pde files with the Arduino IDE and have them automatically open.

Arduino Basics 1: LEDs

I am going to start with some very simple programs, but hopefully build and program them in such a way that they can easily be reused in larger programs without too much modification.

LEDs are used in many applications and can be very useful when debugging. Turning on an LED can be compared to writing "Hello World" or some other test statement to the terminal window. LEDs have a positive end (the longer one) and a negative end (shorter). When hooking up a circuit make sure that the LED has the correct orientation.

Continue reading Arduino Basics 1: LEDs

C++ Grid Class

This is a basic grid class which I plan to use for some simple games including a rewrite of my Connect Four game. This grid class uses std::vector for easy memory management.

Accessors:

  • height()
  • width()
  • retrieve(n, m)
  • print()

Mutalators:

  • insert(n, m, x)
  • resize(n, m)

Download

Arduino

Arduino UnoI am now an owner of an Arduino Uno. I also purchased several 'value packs' of various components, LEDs and some basic sensors. I was able to find some buttons and switches and motors laying around and in old electronics.

I have a good theoretical knowledge of circuits, and after two classes on them I can tell you the voltage or current at any point in almost any circuit. I know opamps and transistors like the back of my hand, but designing a circuit from scratch was surprisingly never covered.

After some quick reading and installing the software it seems like the Arduino programming language is heavily based off of C/C++ which is good because I don't have to relearn any syntax.

Hopefully I will start posting some basic accomplishments soon such as turning on LEDs.

Data Structures and Algorithms

I just finished taking a data structures and algorithms course which was very cool and broadened my perspective when it comes to programming. Although we only got to program a small portion of the things we learned about, I feel that what I did implement is clean and efficient.

Mouse Jail for Twinview

This program will trap the mouse within certain screen coordinates. It can keep your mouse in 1 screen when trying to play games so it doesn't mess up side scrolling and eliminates the possibility of clicking on other windows which makes the game lose focus. The original version of MouseJail was designed to work with xinerama, but I modified it so that it works with nVidia's twinview. I personally use Openbox and it works great.

To use, just compile it and then run it like this (use appropriate coordinates):
./Jail 0 0 1920 1080
Note that the mouse might jump outside those boundaries for quick moments so use:
./Jail 0 0 1917 1080

Download

Connect Four

This is a console Connect Four game. This initial release only has support for a two player game, but I plan to add AI soon. Once I become more comfortable with C++ I will try to add graphics.

Download

 

DI.FM Radio Player

DI.FM radio playerThis project is basically a port of Manadar's windows edition.

All the streams and stream names can be customized easily via a ~/.streams file, and the amount you wish to have is flexible. You are also not limited to di.fm streams, any stream should work.

This project is still in an alpha stage. As of now:
-Recording doesn't work.
-Statusbar text doesn't scroll.
-The ~/.streams file isĀ  in the same directory as the script to make testing easier.

If you find a bug, problem, something you would like to have or a way to fix the above problems please let me know.

Python, wxpython and gstreamer are required.

Download

Netcfg Auto Connect

This script scans to see what networks are available, then checks if any of the networks are ones you want to auto connect to. If this is the case it will connect to the approperiate netcfg profile.
I start this script in my /etc/rc.local. Pick what is best for your distribution.

Continue reading Netcfg Auto Connect