Author Topic: [Semi-blog] My quest to learn Linux, coding, and micro controllers all at once  (Read 3602 times)

0 Members and 1 Guest are viewing this topic.

Offline Melvang

  • Exquisite Lord of Bumfluff
  • * Maker
  • Thread Starter
  • Posts: 4398
  • Location: Waterloo, IA
  • Melvang's Desktop Customs
I am going to preface this by saying, if you use anything in this for your own learning, please take everything with a grain of salt.  I am learning all this myself.  I will try and keep things separated based on topic, Linux (using Mint 18.1 Cinnamon), coding (starting with the Arduino IDE and the Teensyduino addon software), and finally micro controllers (currently I only have a couple Teensys but that might change in the near future.

If you are following this, to use, and run into a blank spot, please ask.  I very well may have forgotten a step or two.

Linux

Ok, I started by getting Linux running on dual boot on an older laptop I had inherited from my father in law when he passed a couple years ago.  This laptop was a couple years old then so it is a bit dated.  The reason for Linux vs windows, was based on experience a year or so ago.  I was trying to compile some firmware for a keyboard and learned that the GCC/AVR compiler for windows was broken badly.  This led me to wiping a spare drive in my desktop and installing Ubuntu on it just to compile one single keyboard firmware.  I needed to basically get my hand held through that process but I did succeed in that endeavor.  Fast forward to now, I want to build my own keyboard from the ground up, learning electronics in general, doing an onboard controller daughter board of my design, possibly writing my own firmware, or modify an existing one with a GUI to make it super simple to get a custom layout, like Xwhatsit level easy.

I installed Mint 18.1 Cinnamon on this laptop in dual boot, got it running, messed up a software install, screwed it up worse trying to uninstall it, and said screw it.  I then wiped the drive, and installed the same OS as the sole OS on the machine.

If you have never used Linux, it is a pretty different experience than windows.  Just knowing that if you type something in wrong in the terminal, it could be bad.  After installing, I went down the list of this site and did some tweaks.  Everything went smooth and is seeming to work as advertised. 

https://sites.google.com/site/easylinuxtipsproject/mint-cinnamon-first

Couple notes on copying and pasting into and out of the terminal.  Copying and pasting while outside the terminal is the same, but inside the keystroke command is Ctrl+Shift+ C or V.  Also, up and down arrows cycle through previous entries.  When you are typing in your password, it is normal behavior for NOTHING to show up when typing in your password, this will take some getting used to.

After going through that, I set about installing the Teensy Loader.  This is a bit different than on windows.  From this link, click on the Linux (Ubuntu) link.  Just so people know, Mint was designed from Ubuntu so from my understanding, the vast majority of software that works for Ubuntu will work on Mint, at least I have yet to find something that doesn't.  From this link, download the proper Teensy program, your choices are 32 bit, 64, bit, or for Raspberry Pi.  You also have download links for a pile of LED Blink .hex files.  These files are named based on what they are for, slow/fast is speed of blinking, the number is the version of the Teensy, and the pp after the number is for ++ versions.

From here you have to extract the .tar.gz file to the machine.  I created a folder in Documents named Teensy for this.

A heads up, this is all you need to do for the program to run, but because of permissions and "rules", you will not be able to change the firmware on the Teensy.  To do this you will need to install the Linux udev rules.  The bottom link in the list of 5 IS the file, with your browser SHOWING the contents of the file.  To download this file there are two options.  One is to create a dummy file in a random location, and copy/paste the contents of that page into the dummy file, and rename it properly.  I did not do this, but was told in the Linuxmint-help IRC channel that it would work.  Instead I used the following command to download it via terminal.  I did it this way because you have to move it to the proper location via terminal anyway.  So, these are the two commands I used to copy and move the file.

Code: [Select]
wget -O 49-teensy.rules http://www.pjrc.com/teensy/49-teensy.rules
Some notes about this command, mostly writing this out so I remember it better and have a later reference.  The "wget" is the command to download, the "-O" means that the wget command will write the document/s to FILE.  The 49-teensy.rules is the file name, and http://www.pjrc.com/teensy/49-teensy.rules is the location of the file.  Now the naming of that file is pretty specifc for Linux.  About all I understand so far, is that the number used, has to do with the level that it runs at, this should not be changed.  That is about all I know.

After you download the file, you need to move the file to the proper location via terminal.  That is accomplished with the following command. 

Code: [Select]
sudo cp 49-teensy.rules /etc/udev/rules.d/49-teensy.rules
Now, some notes on this command.  The 'cp' is the actual copy command.  The 'sudo' means to do the command with root privledges.  Please correct me if I am wrong here.  Obviously, the next items in the command are the file to be copied, and the location to be copied to.

After this, log out and back in, and you should be able to reflash your teensy no problem. 

I am going to call it a night here, will be back tomorrow and add more to this.
OG Kishsaver, Razer Orbweaver clears and reds with blue LEDs, and Razer Naga Epic.   "Great minds crawl in the same sewer"  Uncle Rich

Offline Melvang

  • Exquisite Lord of Bumfluff
  • * Maker
  • Thread Starter
  • Posts: 4398
  • Location: Waterloo, IA
  • Melvang's Desktop Customs
Coding General
OG Kishsaver, Razer Orbweaver clears and reds with blue LEDs, and Razer Naga Epic.   "Great minds crawl in the same sewer"  Uncle Rich

Offline Melvang

  • Exquisite Lord of Bumfluff
  • * Maker
  • Thread Starter
  • Posts: 4398
  • Location: Waterloo, IA
  • Melvang's Desktop Customs
Micro controllers
OG Kishsaver, Razer Orbweaver clears and reds with blue LEDs, and Razer Naga Epic.   "Great minds crawl in the same sewer"  Uncle Rich

Offline Melvang

  • Exquisite Lord of Bumfluff
  • * Maker
  • Thread Starter
  • Posts: 4398
  • Location: Waterloo, IA
  • Melvang's Desktop Customs
KiCad
OG Kishsaver, Razer Orbweaver clears and reds with blue LEDs, and Razer Naga Epic.   "Great minds crawl in the same sewer"  Uncle Rich

Offline Flyersfan1

  • * Destiny Supporter
  • Posts: 1209
  • Location: Philadelphia
  • Hi!
Hey Melvang,

Good luck on the Linux journey, it's a really fascinating and fun OS to explore and learn.  If you're looking for any good reading material, I can't recommend this book enough.  It's very well written and fun to follow along with, I'm about halfway through and feel so much more confident navigating the command line than I did a month ago.  You really learn quickly how powerful it is and what a practical skill it is to know even if development is not a career aspiration.  I'm really looking forward to following your progress.
Quote from: Photekq
i know people who think salt is spicy

Offline Melvang

  • Exquisite Lord of Bumfluff
  • * Maker
  • Thread Starter
  • Posts: 4398
  • Location: Waterloo, IA
  • Melvang's Desktop Customs
Hey Melvang,

Good luck on the Linux journey, it's a really fascinating and fun OS to explore and learn.  If you're looking for any good reading material, I can't recommend this book enough.  It's very well written and fun to follow along with, I'm about halfway through and feel so much more confident navigating the command line than I did a month ago.  You really learn quickly how powerful it is and what a practical skill it is to know even if development is not a career aspiration.  I'm really looking forward to following your progress.

Thank you for the suggestion, I will look into it.
OG Kishsaver, Razer Orbweaver clears and reds with blue LEDs, and Razer Naga Epic.   "Great minds crawl in the same sewer"  Uncle Rich

Offline Melvang

  • Exquisite Lord of Bumfluff
  • * Maker
  • Thread Starter
  • Posts: 4398
  • Location: Waterloo, IA
  • Melvang's Desktop Customs
Is there a way to enable scrolling with the middle mouse button held down?

Not on my linux machine right now.
OG Kishsaver, Razer Orbweaver clears and reds with blue LEDs, and Razer Naga Epic.   "Great minds crawl in the same sewer"  Uncle Rich

Offline suicidal_orange

  • * Global Moderator
  • Posts: 4771
  • Location: England
Of course, pretty much anything is possible it's just a matter of how :)

Sometimes you need to search for Mint and sometimes Linux, the hardest part is knowing which is required for the problem at hand.  In this case it's Xorg which is responsible for the whole gui - this should work, unless they moved the config files.  Not at my computer to test either...
120/100g linear Zealio R1  
GMK Hyperfuse
'Split everything' perfection  
MX Clear
SA Hack'd by Geeks     
EasyAVR mod

Offline Melvang

  • Exquisite Lord of Bumfluff
  • * Maker
  • Thread Starter
  • Posts: 4398
  • Location: Waterloo, IA
  • Melvang's Desktop Customs
Of course, pretty much anything is possible it's just a matter of how :)

Sometimes you need to search for Mint and sometimes Linux, the hardest part is knowing which is required for the problem at hand.  In this case it's Xorg which is responsible for the whole gui - this should work, unless they moved the config files.  Not at my computer to test either...

Thanks for the tip, will look into it tonight.

My next quest is to compile the source code for Xwhatsit utility.  And some quick questions.

Do I need to install something specific for compiling?

How do I tell what language the source files are in?

Is there a chart I can refer to for the colors in the terminal from doing an 'ls' command?
OG Kishsaver, Razer Orbweaver clears and reds with blue LEDs, and Razer Naga Epic.   "Great minds crawl in the same sewer"  Uncle Rich

Offline abjr

  • Posts: 171
  • Location: Connecticut
    • abjr.org
Hi, Melvang. Here are a couple points:

1) wget does not need -O
Code: [Select]
wget http://www.pjrc.com/teensy/49-teensy.rules
will save to 49-teensy.rules by default. You can use -O to save to a different name. If you use curl instead of wget you'd need -O to save to a file.

2) Regarding your question about the colors. You can check a few ways. The first 2 are a little cryptic.
  a) dircolors -p
  b) echo $LS_OPTIONS
  c) typing "ls -F" will classify each file type according to the following:
       Append a character to each file name indicating the file type.
       Also, for regular files that are executable, append `*'.  The file
       type indicators are `/' for directories, `@' for symbolic links,
       `|' for FIFOs, `=' for sockets, `>' for doors, and nothing for
       regular files. 

I hope this is useful.

-abjr
CM QFR | magicforce 68 (Gateron) | magicforce 68 (Outemu) | Acros 6311-K

Offline Melvang

  • Exquisite Lord of Bumfluff
  • * Maker
  • Thread Starter
  • Posts: 4398
  • Location: Waterloo, IA
  • Melvang's Desktop Customs
Hi, Melvang. Here are a couple points:

1) wget does not need -O
Code: [Select]
wget http://www.pjrc.com/teensy/49-teensy.rules
will save to 49-teensy.rules by default. You can use -O to save to a different name. If you use curl instead of wget you'd need -O to save to a file.

2) Regarding your question about the colors. You can check a few ways. The first 2 are a little cryptic.
  a) dircolors -p
  b) echo $LS_OPTIONS
  c) typing "ls -F" will classify each file type according to the following:
       Append a character to each file name indicating the file type.
       Also, for regular files that are executable, append `*'.  The file
       type indicators are `/' for directories, `@' for symbolic links,
       `|' for FIFOs, `=' for sockets, `>' for doors, and nothing for
       regular files. 

I hope this is useful.

-abjr

It is a bit.  Now I am trying to figure out how to get the xwhatsit source code compiled so I can use that utility on Linux.
OG Kishsaver, Razer Orbweaver clears and reds with blue LEDs, and Razer Naga Epic.   "Great minds crawl in the same sewer"  Uncle Rich

Offline abjr

  • Posts: 171
  • Location: Connecticut
    • abjr.org
I guess you will need AVR toolchain:

try: sudo apt-get install gcc-avr binutils-avr avr-libc avrdude

CM QFR | magicforce 68 (Gateron) | magicforce 68 (Outemu) | Acros 6311-K

Offline Melvang

  • Exquisite Lord of Bumfluff
  • * Maker
  • Thread Starter
  • Posts: 4398
  • Location: Waterloo, IA
  • Melvang's Desktop Customs
I guess you will need AVR toolchain:

try: sudo apt-get install gcc-avr binutils-avr avr-libc avrdude

https://geekhack.org/index.php?topic=86738.0

This is where I am stuck at.  Got the idea for using the IDE from bottom of page 33 in the Xwhatsit market place thread at DT
OG Kishsaver, Razer Orbweaver clears and reds with blue LEDs, and Razer Naga Epic.   "Great minds crawl in the same sewer"  Uncle Rich

Offline abjr

  • Posts: 171
  • Location: Connecticut
    • abjr.org
Ahh. OK. Looks like the util is a Qt app. From the error I think you need to install the following package as well:

sudo apt-get install libhidapi-dev
CM QFR | magicforce 68 (Gateron) | magicforce 68 (Outemu) | Acros 6311-K

Offline Melvang

  • Exquisite Lord of Bumfluff
  • * Maker
  • Thread Starter
  • Posts: 4398
  • Location: Waterloo, IA
  • Melvang's Desktop Customs
Ahh. OK. Looks like the util is a Qt app. From the error I think you need to install the following package as well:

sudo apt-get install libhidapi-dev

will try that and report back
OG Kishsaver, Razer Orbweaver clears and reds with blue LEDs, and Razer Naga Epic.   "Great minds crawl in the same sewer"  Uncle Rich