Skip to content
Permalink
main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time

Tips for the coursework

Writing robust C code

  • Avoid the use of global variables, particularly as shared areas between two processes
  • Choose meaningful variable and function names.
  • Remove code that is not relevant. Do not leave commented out code in your final version that you submit—there really is no excuse for doing this.
  • Avoid magic numbers.
  • Avoid unnecessary side effects. Use instead struct to create a data structure to hold information that needs to be preserved between function calls.
  • Never ignore warnings from the compiler.
  • Do not repeat yourself - you shouldn’t have duplicates of the same section of code in several parts of your code listing. Similarly, do not make several copies of the code for different parts of the demo (i.e., don’t have one for when testing on the network and a separate source code for testing the sensor).
  • Make cohesive and coherent functions - the contents of a function (or process thread) should sit naturally with one another. E.g., avoid having a function that both performs some computation and sends a message—such functions should be split into two separate parts.
  • Every function that can be tested should be tested. E.g., when calculating the humidity from the sensor reading, a separate function is needed to perform the calculation and then this should be tested to see that it does its job correctly.

Video production

  • It’s recommended to use screen capture when showing things on the screen
  • Do not show your source code - consider what you would show a boss rather than an academic
  • Do not show the compilation unless there is a strong reason (e.g., an error message that you couldn’t resolve)
  • Make sure you answer these questions:
    1. Do the test cases pass?
    2. Can the mote print out meaningful values including floating point numbers?
    3. Do those values change when we do something to the sensor?
    4. Does the networking mechanism support multi-hop?