Stacks and Queues

Welcome back to the Digilent Blog! When we were working in C, we learned about the data structure called a “linked list”. Now, we’re going to go over two new data structures — stacks and queues. In this post, we’re going to make classes for stacks and queues to help show some of the capabilities of OOP (object-oriented programming)!

Read More

Recursion

Welcome back to the Digilent Blog! Today we’re going to go over recursion! Recursion is when a function calls itself directly, or through another function. Sometimes we can’t solve a problem using loops (iteration), so we have to use recursion. Recursion is slower than iteration, difficult to debug, and it uses up more of the stack. But recursion can also have simpler code, so in some cases, the benefits outweigh the problems.

Read More

What Are “Pointers”?

This blog post will cover the basics of pointers, a programming tool that is used in languages like C and C++. In this post, we will be using C as our primary language. Pointers are variables that contain a memory address (a concept used to access the computer’s primary storage memory). Variables normally contain a value such as 1 or ‘a’, but pointers contain an address of the value. When we reference a variable through pointers, this is called indirection. Each link goes to a text file of C code. This code can be run as is and will help show us the power of pointers!

Read More

Periodically Called Functions Made Easy With the Timers Library

Hey, everyone! Are you getting your week started right by using our awesome MPIDE for your programming needs? Are you just getting started with MPIDE? One of the first major functions used when starting out in MPIDE is the delay() function, as it makes it easy to see an LED blink on and off. However, once things get more complicated and multiple operations become necessary (e.g., configuring multiple digits on a 7-segment to display well as processing the data to display). The Timers library provides a way to easily define functions that should be called periodically. For example, function foo() should be called every 10 milliseconds.

Read More