c - What language should I use for an automatic gear shifting program? -


i thinking writing program automatically change gear of bike. may require microprocessor, question had in mind was: there different language programming microprocessor or can done using c , c++?

another thing is, regarding program, can switch statement work or need pointer or linked list because gear works both ways, , down? bit confused switch statement thing!

  1. one solution designed prototyping , hobby applications basic stamp, based on pic microcontroller including interpreter. programmed in basic rather c/c++ if looking for. keep in mind that there are microcontrollers "worse" 1 have; have programmed in assembly language.

  2. no pointers or linked lists required, because microcontrollers have severely limited memory capacity. switch statement work fine; remember include break statements avoid problems fall-through. it's possible use bit-shifting. yes, curd's answer has truth in it:

    porta = porta & ~0x07 | (1 << selected_gear); 

    where selectedgear starts @ 0 , bike has 3 speeds. write code read sensor inputs , determine correct gear bike should in. so, use finite state machine.


Comments

Popular posts from this blog

Add email recipient to all new Trac tickets -

400 Bad Request on Apache/PHP AddHandler wrapper -

php - Change action and image src url's with jQuery -