Author Topic: help me learn to code  (Read 5073 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
help me learn to code
« on: Sun, 20 July 2014, 05:15:01 »
So I am thinking about delving into the world of coding.  At this point I am not trying to build.my own games or mobile apps and such.  I just want to be able to build my own firmware.  The biggest thing is I want to go at least to the point where I can write my own firmware without just reading a tutorial on what to change in an existing firmware to get the layout I want.

So here is my question.  Can anyone point me in the right direction for books and such to get started in this adventure?
OG Kishsaver, Razer Orbweaver clears and reds with blue LEDs, and Razer Naga Epic.   "Great minds crawl in the same sewer"  Uncle Rich

Offline Zekromtor

  • Posts: 241
    • My Setup
Re: help me learn to code
« Reply #1 on: Sun, 20 July 2014, 07:45:53 »
All the popular C++ books, Sams Teach Yourself C++, C++ For Dummies, though for firmware programming you may want to focus on pure C programming. The object oriented stuff is both overkill and detrimental to performance when coding firmware that is size optimized rather than speed optimized.

Offline Melvang

  • Exquisite Lord of Bumfluff
  • * Maker
  • Thread Starter
  • Posts: 4398
  • Location: Waterloo, IA
  • Melvang's Desktop Customs
Re: help me learn to code
« Reply #2 on: Mon, 21 July 2014, 09:07:55 »
Sorry for the late reply but thanks for the suggestion.  Anything in particular I should look for when making my decisions on what books to get?  I am going to be heading to barnes and Noble today to see what they have on the shelf.  Something like this I think I would prefer a physical book instead of an e-book.
OG Kishsaver, Razer Orbweaver clears and reds with blue LEDs, and Razer Naga Epic.   "Great minds crawl in the same sewer"  Uncle Rich

Offline jdcarpe

  • * Curator
  • Posts: 8852
  • Location: Odessa, TX
  • Live long, and prosper.
Re: help me learn to code
« Reply #3 on: Mon, 21 July 2014, 09:18:20 »
I heard this is a good place to start:




And of course, the reference standard:

KMAC :: LZ-GH :: WASD CODE :: WASD v2 :: GH60 :: Alps64 :: JD45 :: IBM Model M :: IBM 4704 "Pingmaster"

http://jd40.info :: http://jd45.info


in memoriam

"When I was a kid, I used to take things apart and never put them back together."

Offline exitfire401

  • * Global Moderator
  • Posts: 2969
  • Location: United States
  • The Force is Re/\l
Re: help me learn to code
« Reply #4 on: Mon, 21 July 2014, 09:52:17 »
The books help a TON, but if you want some practice, code academy helped me learn a lot. I learned java and python on their site, and by the end, i was fairly proficient.
Boards: Kingsaver Complicated Blue Alps |Sprit 60% Transparent MX Clears in Gateron housings with 62g gold Sprit springs lubed and RGB color shifting LEDs | Ducky Shine Zone MX Black with Blue LEDs | Realforce 10AE Variable Silenced

B/S/T thread: https://geekhack.org/index.php?topic=55351.0

Past projects: KBT Race 2 L.E.
Past Boards: Ducky Shine 2 | KBT Pure | LZ Aluminum Skin| HHKB | Realforce 23u |

Offline Melvang

  • Exquisite Lord of Bumfluff
  • * Maker
  • Thread Starter
  • Posts: 4398
  • Location: Waterloo, IA
  • Melvang's Desktop Customs
Re: help me learn to code
« Reply #5 on: Mon, 21 July 2014, 09:54:41 »
The books help a TON, but if you want some practice, code academy helped me learn a lot. I learned java and python on their site, and by the end, i was fairly proficient.

Thanks for the tip there exitfire401.  I think for this endevor I will prefer physical copy of the material but I will be sure to check it out.

Duly noted as well jdcarpe.
OG Kishsaver, Razer Orbweaver clears and reds with blue LEDs, and Razer Naga Epic.   "Great minds crawl in the same sewer"  Uncle Rich

Offline lkong

  • Posts: 78
  • Location: United States
Re: help me learn to code
« Reply #6 on: Mon, 21 July 2014, 10:13:35 »
afaik you dont have to be an expert of ansi C and such.
Start with some arduino C programming it's intuitive and there are lots of examples available.
More over teensy and arduino were like cousins.

Offline Melvang

  • Exquisite Lord of Bumfluff
  • * Maker
  • Thread Starter
  • Posts: 4398
  • Location: Waterloo, IA
  • Melvang's Desktop Customs
Re: help me learn to code
« Reply #7 on: Mon, 21 July 2014, 10:15:44 »
afaik you dont have to be an expert of ansi C and such.
Start with some arduino C programming it's intuitive and there are lots of examples available.
More over teensy and arduino were like cousins.

I wouldn't say I want to be an expert I just want to understand it more than just "Change this line to represent your layout", Change this to represent which pins are going to which rows and columns.
OG Kishsaver, Razer Orbweaver clears and reds with blue LEDs, and Razer Naga Epic.   "Great minds crawl in the same sewer"  Uncle Rich

Offline cooldiscretion

  • Posts: 747
  • Location: Seattle, WA
  • Convicted guilty of being totally rad.
Re: help me learn to code
« Reply #8 on: Mon, 21 July 2014, 10:37:03 »
I would recommend:

Practical C Programming - OReilly

Also, a few free online resources that you might find helpful are:

http://publications.gbdirect.co.uk/c_book/
http://www.geekboots.com/c/intro

Learning C is a slow process, but it can be quite fun.  My suggestion is to decide whether you feel more comfortable using an IDE
or an Editor like VIM / Emacs as well.  While Emacs and VIM aren't as visual as an IDE, one can become extremely efficient at
coding once the initial learning curve is over.

Offline lkong

  • Posts: 78
  • Location: United States
Re: help me learn to code
« Reply #9 on: Mon, 21 July 2014, 10:38:34 »
afaik you dont have to be an expert of ansi C and such.
Start with some arduino C programming it's intuitive and there are lots of examples available.
More over teensy and arduino were like cousins.

I wouldn't say I want to be an expert I just want to understand it more than just "Change this line to represent your layout", Change this to represent which pins are going to which rows and columns.
then you dont have to learn C.
Not to say algorithms and such.
Keyboard firmware is more hardware related, learn some basics about ardurino sensor inputs and how a keyboard matrix works.
And then tweak around aka break your board, you will learn from that.

Offline Grendel

  • Posts: 462
  • Location: OR, USA
    • Firmware for Costar Replacement Controllers
Re: help me learn to code
« Reply #10 on: Mon, 21 July 2014, 13:04:08 »
And of course, the reference standard:

Show Image

This. Best reference manual EVER.
Currently using: RK-9000WH/GR, CMS QFXT w/ Ghost Squid
- I'm game !

Offline davkol

  •  Post Editing Timeout
  • Posts: 4994
Re: help me learn to code
« Reply #11 on: Mon, 21 July 2014, 14:12:37 »
inb4 a programming language flamewar

Can you program at all? Do you know how computers (processors, memory) and operating systems work? If not, don't start with C and definitely not C++, because there's a big risk you'll quit early.

My recommendation, start with some Python/Ruby tutorial and write scripts that actually help you, like rename some files for you or visualize some data, maybe write a game in PyGame. Once you feel confident, leave the comfort zone and start with C. Maybe with some hardware kit.

Also, use git.

Offline user 18

  • * Senior Moderator
  • Posts: 2231
  • Location: Deutschland
Re: help me learn to code
« Reply #12 on: Mon, 21 July 2014, 14:13:32 »
And of course, the reference standard:

Show Image


Such a useful book.
Please PM me if you are waiting on classifieds approval or have a question about the classifieds rules. | geekhack Terms of Service

Max Nighthawk x8 (MX Brown) | CM QFR (MX Blue) | CM QFR (MX Clear) | RK-9000 (MX Red) | Model M 1391401 | Model M SSK 1370475 | CM Novatouch | G80-8113 (MX Clear) | 60% (85g MX Blue) | Whitefox Aria (MX Clear) | CL-LX (MX Clear) | Mira SE (MX Clear)
Avatar by ashdenej

Offline xauser

  • Posts: 97
Re: help me learn to code
« Reply #13 on: Mon, 21 July 2014, 14:25:03 »
then you dont have to learn C.
Not to say algorithms and such.
Keyboard firmware is more hardware related, learn some basics about ardurino sensor inputs and how a keyboard matrix works.
And then tweak around aka break your board, you will learn from that.

Best advice in my opinion so far! You say "I just want to be able to build my own firmware" but that is not as simple as you might think. You have to deal with low level c, hardware chips and their specs, pcb designs and multiplexers. No single book will give you that.

If you really want to know more about firmware internals, take a smaller step. Do start with simple layout mappings and proceed from there to the next tier. The best starting point for all this is hasu's work. There you have everything in one place. Read it, modify it, improve it, take your improvements back to hasu. tmk firmware has a lot of feature requests waiting for you!
« Last Edit: Mon, 21 July 2014, 14:29:03 by xauser »

Offline tbc

  • Posts: 2365
Re: help me learn to code
« Reply #14 on: Mon, 21 July 2014, 20:40:29 »
My recommendation, start with some Python/Ruby tutorial and write scripts that actually help you, like rename some files for you or visualize some data, maybe write a game in PyGame. Once you feel confident, leave the comfort zone and start with C. Maybe with some hardware kit.

please for the love of god, let's stop with the use of whitespace sensitive languages (python).

ALL zombros wanted:  dead or undead or dead-dead.

Offline rowdy

  • HHKB Hapster
  • * Erudite Elder
  • Posts: 21175
  • Location: melbourne.vic.au
  • Missed another sale.
Re: help me learn to code
« Reply #15 on: Mon, 21 July 2014, 20:47:50 »
My recommendation, start with some Python/Ruby tutorial and write scripts that actually help you, like rename some files for you or visualize some data, maybe write a game in PyGame. Once you feel confident, leave the comfort zone and start with C. Maybe with some hardware kit.

please for the love of god, let's stop with the use of whitespace sensitive languages (python).



What's wrong with Python?

Leaving out indentation is easier to spot than missing a } somewhere.

And you probably indent your source already, right?
"Because keyboards are accessories to PC makers, they focus on minimizing the manufacturing costs. But that’s incorrect. It’s in HHKB’s slogan, but when America’s cowboys were in the middle of a trip and their horse died, they would leave the horse there. But even if they were in the middle of a desert, they would take their saddle with them. The horse was a consumable good, but the saddle was an interface that their bodies had gotten used to. In the same vein, PCs are consumable goods, while keyboards are important interfaces." - Eiiti Wada

NEC APC-H4100E | Ducky DK9008 Shine MX blue LED red | Ducky DK9008 Shine MX blue LED green | Link 900243-08 | CM QFR MX black | KeyCool 87 white MX reds | HHKB 2 Pro | Model M 02-Mar-1993 | Model M 29-Nov-1995 | CM Trigger (broken) | CM QFS MX green | Ducky DK9087 Shine 3 TKL Yellow Edition MX black | Lexmark SSK 21-Apr-1994 | IBM SSK 13-Oct-1987 | CODE TKL MX clear | Model M 122 01-Jun-1988

Ị̸͚̯̲́ͤ̃͑̇̑ͯ̊̂͟ͅs̞͚̩͉̝̪̲͗͊ͪ̽̚̚ ̭̦͖͕̑́͌ͬͩ͟t̷̻͔̙̑͟h̹̠̼͋ͤ͋i̤̜̣̦̱̫͈͔̞ͭ͑ͥ̌̔s̬͔͎̍̈ͥͫ̐̾ͣ̔̇͘ͅ ̩̘̼͆̐̕e̞̰͓̲̺̎͐̏ͬ̓̅̾͠͝ͅv̶̰͕̱̞̥̍ͣ̄̕e͕͙͖̬̜͓͎̤̊ͭ͐͝ṇ̰͎̱̤̟̭ͫ͌̌͢͠ͅ ̳̥̦ͮ̐ͤ̎̊ͣ͡͡n̤̜̙̺̪̒͜e̶̻̦̿ͮ̂̀c̝̘̝͖̠̖͐ͨͪ̈̐͌ͩ̀e̷̥͇̋ͦs̢̡̤ͤͤͯ͜s͈̠̉̑͘a̱͕̗͖̳̥̺ͬͦͧ͆̌̑͡r̶̟̖̈͘ỷ̮̦̩͙͔ͫ̾ͬ̔ͬͮ̌?̵̘͇͔͙ͥͪ͞ͅ

Offline user 18

  • * Senior Moderator
  • Posts: 2231
  • Location: Deutschland
Re: help me learn to code
« Reply #16 on: Mon, 21 July 2014, 20:53:18 »
I thought the whole point of learning with python was to teach people to write legible code.
Please PM me if you are waiting on classifieds approval or have a question about the classifieds rules. | geekhack Terms of Service

Max Nighthawk x8 (MX Brown) | CM QFR (MX Blue) | CM QFR (MX Clear) | RK-9000 (MX Red) | Model M 1391401 | Model M SSK 1370475 | CM Novatouch | G80-8113 (MX Clear) | 60% (85g MX Blue) | Whitefox Aria (MX Clear) | CL-LX (MX Clear) | Mira SE (MX Clear)
Avatar by ashdenej

Offline rowdy

  • HHKB Hapster
  • * Erudite Elder
  • Posts: 21175
  • Location: melbourne.vic.au
  • Missed another sale.
Re: help me learn to code
« Reply #17 on: Mon, 21 July 2014, 20:55:06 »
I thought the whole point of learning with python was to teach people to write legible code.

Although you can stuff it up in a big way, Python's mandatory space indentation does encourage cleaner code.
"Because keyboards are accessories to PC makers, they focus on minimizing the manufacturing costs. But that’s incorrect. It’s in HHKB’s slogan, but when America’s cowboys were in the middle of a trip and their horse died, they would leave the horse there. But even if they were in the middle of a desert, they would take their saddle with them. The horse was a consumable good, but the saddle was an interface that their bodies had gotten used to. In the same vein, PCs are consumable goods, while keyboards are important interfaces." - Eiiti Wada

NEC APC-H4100E | Ducky DK9008 Shine MX blue LED red | Ducky DK9008 Shine MX blue LED green | Link 900243-08 | CM QFR MX black | KeyCool 87 white MX reds | HHKB 2 Pro | Model M 02-Mar-1993 | Model M 29-Nov-1995 | CM Trigger (broken) | CM QFS MX green | Ducky DK9087 Shine 3 TKL Yellow Edition MX black | Lexmark SSK 21-Apr-1994 | IBM SSK 13-Oct-1987 | CODE TKL MX clear | Model M 122 01-Jun-1988

Ị̸͚̯̲́ͤ̃͑̇̑ͯ̊̂͟ͅs̞͚̩͉̝̪̲͗͊ͪ̽̚̚ ̭̦͖͕̑́͌ͬͩ͟t̷̻͔̙̑͟h̹̠̼͋ͤ͋i̤̜̣̦̱̫͈͔̞ͭ͑ͥ̌̔s̬͔͎̍̈ͥͫ̐̾ͣ̔̇͘ͅ ̩̘̼͆̐̕e̞̰͓̲̺̎͐̏ͬ̓̅̾͠͝ͅv̶̰͕̱̞̥̍ͣ̄̕e͕͙͖̬̜͓͎̤̊ͭ͐͝ṇ̰͎̱̤̟̭ͫ͌̌͢͠ͅ ̳̥̦ͮ̐ͤ̎̊ͣ͡͡n̤̜̙̺̪̒͜e̶̻̦̿ͮ̂̀c̝̘̝͖̠̖͐ͨͪ̈̐͌ͩ̀e̷̥͇̋ͦs̢̡̤ͤͤͯ͜s͈̠̉̑͘a̱͕̗͖̳̥̺ͬͦͧ͆̌̑͡r̶̟̖̈͘ỷ̮̦̩͙͔ͫ̾ͬ̔ͬͮ̌?̵̘͇͔͙ͥͪ͞ͅ

Offline jdcarpe

  • * Curator
  • Posts: 8852
  • Location: Odessa, TX
  • Live long, and prosper.
Re: help me learn to code
« Reply #18 on: Mon, 21 July 2014, 20:58:18 »
You guys obviously never had to write any code in Fortran 77. Count yourselves lucky.

And Melvang, just skip the high level languages altogether and go straight for x86 assembler. ;)
KMAC :: LZ-GH :: WASD CODE :: WASD v2 :: GH60 :: Alps64 :: JD45 :: IBM Model M :: IBM 4704 "Pingmaster"

http://jd40.info :: http://jd45.info


in memoriam

"When I was a kid, I used to take things apart and never put them back together."

Offline Smasher816

  • HHKB Master
  • Posts: 538
  • Location: return STATE_MISSOURI;
Re: help me learn to code
« Reply #19 on: Mon, 21 July 2014, 21:11:22 »
Ohh yeah, z80 assembly was tons of fun. Not even a multiply opcode on those old chips :P

Offline swill

  • * Elevated Elder
  • Posts: 3365
  • Location: Canada eh
  • builder & enabler
    • swillkb.com
Re: help me learn to code
« Reply #20 on: Mon, 21 July 2014, 21:18:47 »
You guys obviously never had to write any code in Fortran 77. Count yourselves lucky.

And Melvang, just skip the high level languages altogether and go straight for x86 assembler. ;)

Haha. JD, you are just mean. :)

My 0.02$ on the topic.

If you want a simple language that is easy to learn and work with, I would recommend Python. Having an interpreter to test things in when you are learning is invaluable.

Python is a dynamically typed language, so you get to skip some of the complexity too get started.

C is a solid language, but I would not recommend it as your first language. You don't need to learn about pointers and things like malloc and calloc on your first intro to programming.

If you start with python and build something cool, you can learn C by writing a small piece of your python program in C and importing it into python. Because python allows importing of C libs and you will have written the code once in python, you will learn a lot about the differences between high level dynamic languages and low level statically typed languages.

As for an editor, I would suggest Sublime Text 3. Not an IDE, but a joy to work in.

This does not address firmware coding specifically. In that case I like the idea of learning from an existing open-source tool. Read the code and absorb what you can. Google will your bestest of friends.
« Last Edit: Mon, 21 July 2014, 21:20:22 by swill »

Offline bueller

  • MX baller
  • * Esteemed Elder
  • Posts: 3769
  • Location: Perth, Australia
  • Church of the Ergo Clear
Re: help me learn to code
« Reply #21 on: Mon, 21 July 2014, 21:27:05 »
You guys obviously never had to write any code in Fortran 77. Count yourselves lucky.

And Melvang, just skip the high level languages altogether and go straight for x86 assembler. ;)

Haha. JD, you are just mean. :)

My 0.02$ on the topic.

If you want a simple language that is easy to learn and work with, I would recommend Python. Having an interpreter to test things in when you are learning is invaluable.

Python is a dynamically typed language, so you get to skip some of the complexity too get started.

C is a solid language, but I would not recommend it as your first language. You don't need to learn about pointers and things like malloc and calloc on your first intro to programming.

If you start with python and build something cool, you can learn C by writing a small piece of your python program in C and importing it into python. Because python allows importing of C libs and you will have written the code once in python, you will learn a lot about the differences between high level dynamic languages and low level statically typed languages.

As for an editor, I would suggest Sublime Text 3. Not an IDE, but a joy to work in.

This does not address firmware coding specifically. In that case I like the idea of learning from an existing open-source tool. Read the code and absorb what you can. Google will your bestest of friends.

I'd agree with this, I tried learning C years ago when I first got interested in programming and the complexity of it put me off. Picked up Java and Python about a year ago and since then I haven't been able to stop.
It's a good width!  If it's half-width it's too narrow, and full-width is too wide. 

[WTT] bueller's trade thread - CLACKS WANTED

Offline Belfong

  • Posts: 5217
  • Location: Malaysia
Re: help me learn to code
« Reply #22 on: Mon, 21 July 2014, 21:33:37 »
I have the same dream of wanting to learn to code. I tried watching the Standford University free iOS development course and got lost. After failing a few times (I have tried reading books too and failed), I decided to man up, fork out some money, took 5 days off work and I am currently in a iOS Development class. Today is my second day. I learned so much more in my first day, via an instructor led class than I have learned from the Standford Uni courses. I think the other important thing is the uninterrupted 8 hour of concentrating on the class and the material! So happy with this decision!

But using Xcode requires a lot of arrow keys. I don't understand how a HHKB can work well here (sad panda).. but I guess that is for another thread.
 

Offline swill

  • * Elevated Elder
  • Posts: 3365
  • Location: Canada eh
  • builder & enabler
    • swillkb.com
Re: help me learn to code
« Reply #23 on: Mon, 21 July 2014, 21:49:39 »
I tried learning C years ago when I first got interested in programming and the complexity of it put me off. Picked up Java and Python about a year ago and since then I haven't been able to stop.

Ya, I hear that.  I have been coding professionally for over 10 years and C is even daunting to me.  Its not that I can't do it, its just another level of brain power that I don't want to have to work in all the time.  In contrast, when I am feeling overwhelmed with different projects at work, I find a little project where I can take 2 or 3 days and work in Python for a bit.  It recharges me and brings my brain back to a much more peaceful place.

Discaimer:  I think this is important to note.  If you are not a programmer you won't know this and if you are, you may just choose to ignore it.  :P

Dynamically typed languages (like Python or Ruby) a slower at crunching numbers and operations.  So if you want to calculate Pi to 100 places or you want to output the first 1000 values of the fibonacci sequence, you will not want to pick a dynamically type language (if you care about run time at all).

Statically typed languages on the other hand, while being much harder and more cumbersome to write, offer a substantial gain in performance when doing data heavy operations.  In this case you will want to understand pointers and lower level data constructs because that is how you will achieve the performance to perform operations quickly.

In most code you will not notice a difference in speed between dynamically and statically typed languages, but when doing heavy calculations, you absolutely will.  As a rule of thumb, if you are dealing with objects with less than 100 elements, you will not notice a difference between dynamically and statically typed languages.  If you start doing heavy calculations on objects with over 1000 elements, you probably want to start considering a statically typed language.

Offline Geke_Hackman

  • Posts: 18
Re: help me learn to code
« Reply #24 on: Mon, 21 July 2014, 21:57:25 »
New to coding too, but so far CS50 has been a good course for learning the basic principles. Think it's offered on itunes, edx and harvard online (?).
Visit the Typing Test and try!

Offline swill

  • * Elevated Elder
  • Posts: 3365
  • Location: Canada eh
  • builder & enabler
    • swillkb.com
Re: help me learn to code
« Reply #25 on: Mon, 21 July 2014, 21:58:49 »
Just going to throw this out there cause I think it is a nice way to learn to code (if not a new language for the rest of you coders).

You can go through this Go Lang tutorial and learn a lot about the underlying principles of programming.  Not to mention, it is a statically typed language with an elegant pointer system and it compiles faster than pretty much any other language.  Oh and did I mention it basically has an interactive shell interpreter?

http://tour.golang.org/#1

Go Lang is a language developed at Google because they were sick of working with C++.  They wanted something more dynamic and extensible, so they developed Go.  It has not really caught on too much yet, but I think this language has some serious potential.

Offline hasu

  • Posts: 3472
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: help me learn to code
« Reply #26 on: Mon, 21 July 2014, 22:14:03 »
Lightweight language is very useful for daily job and learning Lisp or functional languages will get your quality-of-life so better. But they are not so fast nor easy path to build your firmware on micro-controller when it comes to embedded thingy.

From my experience without knowledge of low level computer architecture understanding detail of C was very difficult. In the end I needed to learn basic of architecture and instruction set of MCU with its datasheet and app notes. Fortunately you don't have to know lambda calculus or other computational theory here :D

I guess learning MCU with assembly before working on C would be useful and bottom-up approach will work there.
« Last Edit: Mon, 21 July 2014, 22:16:51 by hasu »

Offline swill

  • * Elevated Elder
  • Posts: 3365
  • Location: Canada eh
  • builder & enabler
    • swillkb.com
Re: help me learn to code
« Reply #27 on: Mon, 21 July 2014, 22:33:07 »
Lightweight language is very useful for daily job and learning Lisp or functional languages will get your quality-of-life so better. But they are not so fast nor easy path to build your firmware on micro-controller when it comes to embedded thingy.

From my experience without knowledge of low level computer architecture understanding detail of C was very difficult. In the end I needed to learn basic of architecture and instruction set of MCU with its datasheet and app notes. Fortunately you don't have to know lambda calculus or other computational theory here :D

I guess learning MCU with assembly before working on C would be useful and bottom-up approach will work there.

Functional languages like Lisp are not super slow.  I think in general they are faster than normal dynamically typed languages.  Scala for example is a pretty quick functional language.

Offline Grendel

  • Posts: 462
  • Location: OR, USA
    • Firmware for Costar Replacement Controllers
Re: help me learn to code
« Reply #28 on: Tue, 22 July 2014, 00:41:54 »
You guys obviously never had to write any code in Fortran 77. Count yourselves lucky.

Or COBOL. What a PITA.

And Melvang, just skip the high level languages altogether and go straight for x86 assembler. ;)

That advice has some merits -- you can't write any serious firmware w/o understanding the underlying MCU. So, get the K&R and datasheet, then find some source code and try to make sens of it. Next thing you know you'll be writing some code ;)
Currently using: RK-9000WH/GR, CMS QFXT w/ Ghost Squid
- I'm game !

Offline Melvang

  • Exquisite Lord of Bumfluff
  • * Maker
  • Thread Starter
  • Posts: 4398
  • Location: Waterloo, IA
  • Melvang's Desktop Customs
Re: help me learn to code
« Reply #29 on: Tue, 22 July 2014, 00:55:30 »
You guys obviously never had to write any code in Fortran 77. Count yourselves lucky.

Or COBOL. What a PITA.

And Melvang, just skip the high level languages altogether and go straight for x86 assembler. ;)

That advice has some merits -- you can't write any serious firmware w/o understanding the underlying MCU. So, get the K&R and datasheet, then find some source code and try to make sens of it. Next thing you know you'll be writing some code ;)

The biggest issue with your advice Grendel (and by all means I don't want to sound like a ****) I have no idea with K&R or what datasheet I would be looking for.  I have not written a single line of code with the one exception of a couple very simple ones for my Ti-86 back in high school (15 year reunion next year).

A little update.  I have picked up a couple books from Barnes and Noble and am going through the one that is geared toward someone starting from the very beginning.  I have done some of the sample ones and am getting ready to start with a custom piece to give a total dollar figure from numbers of coins of different denominations.

Edit:  I will get to this in the morning.  Didn't realize what time it was and I have jury duty tomorrow.  At least I didn't have to work.  The pay for it is less than an hour and a half of my work.
« Last Edit: Tue, 22 July 2014, 01:04:14 by Melvang »
OG Kishsaver, Razer Orbweaver clears and reds with blue LEDs, and Razer Naga Epic.   "Great minds crawl in the same sewer"  Uncle Rich

Offline rowdy

  • HHKB Hapster
  • * Erudite Elder
  • Posts: 21175
  • Location: melbourne.vic.au
  • Missed another sale.
Re: help me learn to code
« Reply #30 on: Tue, 22 July 2014, 01:04:48 »
It's been a long time since I learned this kind of stuff without the benefit of years of experience.

I can suggest that you set yourself a simple project to complete, preferably relevant to the area you are intending to learn.

Then try to implement it.  When you get stuck, experiment with a few simple examples around the area you are stuck, then apply that knowledge to the main program you are working on.

K&R: http://en.wikipedia.org/wiki/The_C_Programming_Language
"Because keyboards are accessories to PC makers, they focus on minimizing the manufacturing costs. But that’s incorrect. It’s in HHKB’s slogan, but when America’s cowboys were in the middle of a trip and their horse died, they would leave the horse there. But even if they were in the middle of a desert, they would take their saddle with them. The horse was a consumable good, but the saddle was an interface that their bodies had gotten used to. In the same vein, PCs are consumable goods, while keyboards are important interfaces." - Eiiti Wada

NEC APC-H4100E | Ducky DK9008 Shine MX blue LED red | Ducky DK9008 Shine MX blue LED green | Link 900243-08 | CM QFR MX black | KeyCool 87 white MX reds | HHKB 2 Pro | Model M 02-Mar-1993 | Model M 29-Nov-1995 | CM Trigger (broken) | CM QFS MX green | Ducky DK9087 Shine 3 TKL Yellow Edition MX black | Lexmark SSK 21-Apr-1994 | IBM SSK 13-Oct-1987 | CODE TKL MX clear | Model M 122 01-Jun-1988

Ị̸͚̯̲́ͤ̃͑̇̑ͯ̊̂͟ͅs̞͚̩͉̝̪̲͗͊ͪ̽̚̚ ̭̦͖͕̑́͌ͬͩ͟t̷̻͔̙̑͟h̹̠̼͋ͤ͋i̤̜̣̦̱̫͈͔̞ͭ͑ͥ̌̔s̬͔͎̍̈ͥͫ̐̾ͣ̔̇͘ͅ ̩̘̼͆̐̕e̞̰͓̲̺̎͐̏ͬ̓̅̾͠͝ͅv̶̰͕̱̞̥̍ͣ̄̕e͕͙͖̬̜͓͎̤̊ͭ͐͝ṇ̰͎̱̤̟̭ͫ͌̌͢͠ͅ ̳̥̦ͮ̐ͤ̎̊ͣ͡͡n̤̜̙̺̪̒͜e̶̻̦̿ͮ̂̀c̝̘̝͖̠̖͐ͨͪ̈̐͌ͩ̀e̷̥͇̋ͦs̢̡̤ͤͤͯ͜s͈̠̉̑͘a̱͕̗͖̳̥̺ͬͦͧ͆̌̑͡r̶̟̖̈͘ỷ̮̦̩͙͔ͫ̾ͬ̔ͬͮ̌?̵̘͇͔͙ͥͪ͞ͅ

Offline Melvang

  • Exquisite Lord of Bumfluff
  • * Maker
  • Thread Starter
  • Posts: 4398
  • Location: Waterloo, IA
  • Melvang's Desktop Customs
Re: help me learn to code
« Reply #31 on: Tue, 22 July 2014, 01:10:00 »
Thanks rowdy.  Right now I am just trying to get at least a farts chance in a hurricane at understanding this stuff.  The book I have right now is C Programming Absolute Beginners's Guide by Greg Perry and Dean Miller.

So far (granted prebuilt examples of code) the only issues I have had are typos with punctuation. 

They did have one more book at B&N that I was looking at that was entirely about learning to code for the Arduino.
Anyway, off to bed for me, 1 am here and I have to have the kids to school, a shower, and be at jury duty by 8:30.  I have never been a morning person as well.
OG Kishsaver, Razer Orbweaver clears and reds with blue LEDs, and Razer Naga Epic.   "Great minds crawl in the same sewer"  Uncle Rich

Offline rowdy

  • HHKB Hapster
  • * Erudite Elder
  • Posts: 21175
  • Location: melbourne.vic.au
  • Missed another sale.
Re: help me learn to code
« Reply #32 on: Tue, 22 July 2014, 01:15:46 »
Just one more observation from my experience - if you have a good problem solving ability, and can think logically, then you should be able to solve most programming problems.  It's just a case of learning a suitable programming language.

Learning more new languages is secondary to all that.  Once you know one or two languages, you can better assess which language best suits the application you are trying to write, and then either use a language you know, or learn a new one for that problem.
"Because keyboards are accessories to PC makers, they focus on minimizing the manufacturing costs. But that’s incorrect. It’s in HHKB’s slogan, but when America’s cowboys were in the middle of a trip and their horse died, they would leave the horse there. But even if they were in the middle of a desert, they would take their saddle with them. The horse was a consumable good, but the saddle was an interface that their bodies had gotten used to. In the same vein, PCs are consumable goods, while keyboards are important interfaces." - Eiiti Wada

NEC APC-H4100E | Ducky DK9008 Shine MX blue LED red | Ducky DK9008 Shine MX blue LED green | Link 900243-08 | CM QFR MX black | KeyCool 87 white MX reds | HHKB 2 Pro | Model M 02-Mar-1993 | Model M 29-Nov-1995 | CM Trigger (broken) | CM QFS MX green | Ducky DK9087 Shine 3 TKL Yellow Edition MX black | Lexmark SSK 21-Apr-1994 | IBM SSK 13-Oct-1987 | CODE TKL MX clear | Model M 122 01-Jun-1988

Ị̸͚̯̲́ͤ̃͑̇̑ͯ̊̂͟ͅs̞͚̩͉̝̪̲͗͊ͪ̽̚̚ ̭̦͖͕̑́͌ͬͩ͟t̷̻͔̙̑͟h̹̠̼͋ͤ͋i̤̜̣̦̱̫͈͔̞ͭ͑ͥ̌̔s̬͔͎̍̈ͥͫ̐̾ͣ̔̇͘ͅ ̩̘̼͆̐̕e̞̰͓̲̺̎͐̏ͬ̓̅̾͠͝ͅv̶̰͕̱̞̥̍ͣ̄̕e͕͙͖̬̜͓͎̤̊ͭ͐͝ṇ̰͎̱̤̟̭ͫ͌̌͢͠ͅ ̳̥̦ͮ̐ͤ̎̊ͣ͡͡n̤̜̙̺̪̒͜e̶̻̦̿ͮ̂̀c̝̘̝͖̠̖͐ͨͪ̈̐͌ͩ̀e̷̥͇̋ͦs̢̡̤ͤͤͯ͜s͈̠̉̑͘a̱͕̗͖̳̥̺ͬͦͧ͆̌̑͡r̶̟̖̈͘ỷ̮̦̩͙͔ͫ̾ͬ̔ͬͮ̌?̵̘͇͔͙ͥͪ͞ͅ

Offline jacobolus

  • Posts: 3661
  • Location: San Francisco, CA
Re: help me learn to code
« Reply #33 on: Tue, 22 July 2014, 02:13:42 »
I second the suggestion to start using the Arduino toolchain. It cuts out some of the complexity you’d need to deal with when starting from scratch.

Offline tbc

  • Posts: 2365
Re: help me learn to code
« Reply #34 on: Tue, 22 July 2014, 03:00:56 »
on topic:


melvang, do you literally only want to do firmware in C?

otherwise, I find lego mindstorms quite entertaining.  there's probably a cheaper alternative somewhere.  lego mindstorms was java only when I used it though.

offtopic:

My recommendation, start with some Python/Ruby tutorial and write scripts that actually help you, like rename some files for you or visualize some data, maybe write a game in PyGame. Once you feel confident, leave the comfort zone and start with C. Maybe with some hardware kit.

please for the love of god, let's stop with the use of whitespace sensitive languages (python).



What's wrong with Python?

Leaving out indentation is easier to spot than missing a } somewhere.

And you probably indent your source already, right?

1.  because it's an -ism

just like phpism with form inputs
like JS ASIism

adding language specific styles just to look like 'not C' is terribad.

2.  you GREATLY punish developers with visual impairment.

I personally know a dev who prefers to add 3 tabs just to make it easier to read indentations.  if they tried to pull that off here, they would have to unformat/reformat EVERY time they ran their code.  this leads to LESS testing and more time wasted going through the testing cycle (no, a testing framework really doesn't solve this problem - not everything is a library).



basically, run time failure on whitespace causes problems, doesn't actually solve the problem it's trying to fix, and makes the problem it's trying to fix even harder to fix.

something is wrong with your codebase if you can't match up curlys.  having them there if anything is a GOOD thing, it's one of the most obvious code smells.


the issue isn't just with python, but rather the concept of whitespace sensitive languages in general.  just because you can be a hippy doesn't mean you should.
« Last Edit: Tue, 22 July 2014, 03:03:19 by tbc »
ALL zombros wanted:  dead or undead or dead-dead.

Offline jacobolus

  • Posts: 3661
  • Location: San Francisco, CA
Re: help me learn to code
« Reply #35 on: Tue, 22 July 2014, 03:22:02 »
The Python whitespace bashing is really lame and tired. People who have never tried writing serious Python code have been going on about it for decades by this point, and pretty much everyone who ever gives Python a serious shot finds out that after a while (usually hours, maybe days, weeks at most) it turns out to be a complete non-issue.

Trying to badly re-hash arguments that have already resulted in tens of thousands of man-hours of collective hand-wringing is not useful in the context of this forum, and is particularly unhelpful to newbies, who might take such bull**** seriously.

Offline rowdy

  • HHKB Hapster
  • * Erudite Elder
  • Posts: 21175
  • Location: melbourne.vic.au
  • Missed another sale.
Re: help me learn to code
« Reply #36 on: Tue, 22 July 2014, 05:59:27 »
One of the worst things I do (not on a daily basis any more, thank goodness) is try to trace other people's code blocks.  Where the begin and end do not line up, and the code in the middle is all over the place, I usually end up wasting 15 minutes reformatting everything before I can start reviewing the code.

Python is already lined up, I can start reviewing immediately.

And the Python interpreter will tell you straight away if the indentation on a line does not match the rest of the code around it.

But anyway, some people like it, some don't.

Do you vi or emacs? ;)
"Because keyboards are accessories to PC makers, they focus on minimizing the manufacturing costs. But that’s incorrect. It’s in HHKB’s slogan, but when America’s cowboys were in the middle of a trip and their horse died, they would leave the horse there. But even if they were in the middle of a desert, they would take their saddle with them. The horse was a consumable good, but the saddle was an interface that their bodies had gotten used to. In the same vein, PCs are consumable goods, while keyboards are important interfaces." - Eiiti Wada

NEC APC-H4100E | Ducky DK9008 Shine MX blue LED red | Ducky DK9008 Shine MX blue LED green | Link 900243-08 | CM QFR MX black | KeyCool 87 white MX reds | HHKB 2 Pro | Model M 02-Mar-1993 | Model M 29-Nov-1995 | CM Trigger (broken) | CM QFS MX green | Ducky DK9087 Shine 3 TKL Yellow Edition MX black | Lexmark SSK 21-Apr-1994 | IBM SSK 13-Oct-1987 | CODE TKL MX clear | Model M 122 01-Jun-1988

Ị̸͚̯̲́ͤ̃͑̇̑ͯ̊̂͟ͅs̞͚̩͉̝̪̲͗͊ͪ̽̚̚ ̭̦͖͕̑́͌ͬͩ͟t̷̻͔̙̑͟h̹̠̼͋ͤ͋i̤̜̣̦̱̫͈͔̞ͭ͑ͥ̌̔s̬͔͎̍̈ͥͫ̐̾ͣ̔̇͘ͅ ̩̘̼͆̐̕e̞̰͓̲̺̎͐̏ͬ̓̅̾͠͝ͅv̶̰͕̱̞̥̍ͣ̄̕e͕͙͖̬̜͓͎̤̊ͭ͐͝ṇ̰͎̱̤̟̭ͫ͌̌͢͠ͅ ̳̥̦ͮ̐ͤ̎̊ͣ͡͡n̤̜̙̺̪̒͜e̶̻̦̿ͮ̂̀c̝̘̝͖̠̖͐ͨͪ̈̐͌ͩ̀e̷̥͇̋ͦs̢̡̤ͤͤͯ͜s͈̠̉̑͘a̱͕̗͖̳̥̺ͬͦͧ͆̌̑͡r̶̟̖̈͘ỷ̮̦̩͙͔ͫ̾ͬ̔ͬͮ̌?̵̘͇͔͙ͥͪ͞ͅ

Offline Grendel

  • Posts: 462
  • Location: OR, USA
    • Firmware for Costar Replacement Controllers
Re: help me learn to code
« Reply #37 on: Tue, 22 July 2014, 13:08:44 »
The biggest issue with your advice Grendel (and by all means I don't want to sound like a ****) I have no idea with K&R or what datasheet I would be looking for.  I have not written a single line of code with the one exception of a couple very simple ones for my Ti-86 back in high school (15 year reunion next year).

K&R -- Kernighan and Ritchie, The C Programming Language. For what you are planning to do I would suggest to look into Teensy 2.0's. They are based on the Atmel ATMega32U4, tons of source code available, easy to program, good tool chains. The datasheet can be found here (the 433 pages PDF :) ), along w/ a lot more information.

Try to find a smaller project that you can replicate -- build the hardware w/ a breadboard and concentrate on replicating the firmware by setting up a tool chain. Once you can do that, play around w/ the code. Try to understand what's going on and modify it.
« Last Edit: Tue, 22 July 2014, 13:17:59 by Grendel »
Currently using: RK-9000WH/GR, CMS QFXT w/ Ghost Squid
- I'm game !

Offline Wildcard

  • * Esteemed Elder
  • Posts: 1046
  • Location: Fields of Columbia
  • When caffeine isn't enough
Re: help me learn to code
« Reply #38 on: Tue, 22 July 2014, 13:20:18 »
Try to find a smaller project that you can replicate -- build the hardware w/ a breadboard and concentrate on replicating the firmware by setting up a tool chain. Once you can do that, play around w/ the code. Try to understand what's going on and modify it.

This is a good suggestion


Offline swill

  • * Elevated Elder
  • Posts: 3365
  • Location: Canada eh
  • builder & enabler
    • swillkb.com
Re: help me learn to code
« Reply #39 on: Tue, 22 July 2014, 19:54:34 »
Try to find a smaller project that you can replicate -- build the hardware w/ a breadboard and concentrate on replicating the firmware by setting up a tool chain. Once you can do that, play around w/ the code. Try to understand what's going on and modify it.

This is a good suggestion

+1 - I agree.