Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Coding Dojo - The learning remote control

78 views

Published on

A C++ programming exercise where we write the firmware for a learning remote control. The exercise is derived from a real firmware project written in C.
Kata details: http://codewars.com/kata/learning-remote-control/

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Coding Dojo - The learning remote control

  1. 1. Coding Dojo The learning remote control /* a C++ exercise */ @AlinPandichi
  2. 2. Coding Dojo Mindset ● We are here to learn ● Safe place outside of work ● Need to slow down ● Focus on doing it right ● Non­competitive, collaborative, fun  environment
  3. 3. Expectations?
  4. 4. Agenda ● 19:00 ­ 19:10 Introduction   ● 19:10 ­ 19:30 Intro ● 19:30 ­ 20:00 Practice Session Part 1  ● 20:00 ­ 20:10 Break   ● 20:10 ­ 20:45 Practice Session Part 2  ● 20:45 ­ 21:00 Retrospective
  5. 5. The learning remote control ● You are writing the firmware for a  learning remote control. ● You put it into a 'listening' state... ● ...to capture the signal from another IR  remote control ● Your firmware must find a repeating  pattern of pulses
  6. 6. Digital signal processing ● https://www.allaboutcircuits.com/uploads/articles/An­ Introduction­to­Digital­Signal­Processing­(1).png
  7. 7. Other requirements ● on_start_learning_mode to simulate the  user initiating a training operation ● on_signal_change called repeatedly to  simulate a continually repeating input  signal ● Return a list of pulses representing the  detected pattern (or none)
  8. 8. Other requirements ● A pulse is defined as a HIGH/LOW pair  made out of an integer 2­tuple.  ● Each integer pair is the time in  nanoseconds the signal was high for and  then the time in nanoseconds the signal  was low for. For example: # high for 52 nanos, low for 4500 nanos pulse = (52, 4500)
  9. 9. In ASCII art... | (1) (2) (3)(4)(5) (6) (7)(8) <-- | ..................... .... ..... ... <--- HIGH | | | | | | | | | |.....| |...| |..| |.....| | <--- LOW | <- nanos_elapsed -> +------------------------------------------------------------- time_nanos ->
  10. 10. It should look something like this def on_signal_change(is_high, nanos_elapse): # your code ... # then return a pattern return [(50, 4500), (3423, 333), (212,44)]
  11. 11. The following will hold true ● The first invocation of the on_signal_change method  will be the start of the pattern. Note that nanos_elapsed  will be 0 for this first call. ● The first invocation of the on_signal_change method  will always be for a LOW to HIGH transition (rising  edge, is_high is True). ● The pattern will be made up of at least 1 HIGH/LOW  pulse. ● The pattern will be made up of less than 26 HIGH/LOW  pulses. ● The pattern will be made up of ideal pulses (i.e. no  jitter, fuzzyness, or drift).
  12. 12. Practice session ● One laptop with a functional dev. env. is  connected to a projector ● Two developers pair program on the  laptop. The others are watching the code  changes. ● Every 7 minutes, one developer leaves the  laptop and the next one from the room  takes his place. 
  13. 13. Practice time!
  14. 14. Retrospective ● What surprised you? ● What happened as expected? ● What do you plan to use at work?
  15. 15. Kata stolen from: https://www.codewars.com/kata/
  16. 16. Learn more! https://cppeurope.com/
  17. 17. Thank you! @AlinPandichi

×