empowering creative people

Videos / Circuit Playground Express Workshop - Chapter 4 - Serial Console

The Windows app version of MakeCode is made specifically for the Adafruit Circuit Playground Express and comes equipped with some extra features that the web browser version does not have. In this section we will show you one of the features added to the Windows App, console read. Using Console Read we view data sent from the Circuit Playground to the computer in real time. We can use this for troubleshooting or for taking readings.

Search Videos

Related Content

Transcript

+

Hi, welcome back to the Circuit Playground Express online workshop in this section, we're going to learn about the serial console, and we'll look at how we can use it.

So, the serial console returns live data being read from the device’s sensors to the computer so you can view it in real time. So if we hit show console device, right now we're showing the accelerometer readings from the X and Y-axis and as we move until the board it'll be shown as a graph on the screen and all the live readings will be streamed by as they're read down at the bottom of the screen, this can be handy because you can read the actual readings from the device and manipulate your codes, so it works better with those values and you can also use it to just log data and export it to an Excel spreadsheet if you want.

So, let's look at how we did it. Under the Advanced Options down toward the bottom we have our console commands and there are two types of console commands, there's console.log which we use to just print out text in the console whenever we get to that point in code and we have our console log value which is what we use to return a variable so in this case, the variable is the current reading and the accelerometer but it could be just an actual variable that you set up or any other sensor that's been read and these features are really handy when it comes to debugging your program, so if something's going wrong in your code and you're not sure at what point it's going wrong you can create console logs to print out your variables as you go through your code and you can see what's happening, kind of get a peek under the hood, so to speak to understand where it might be going wrong say then you could check your variable toward the end of your code and see if it's the value it should be with things working the way it's working and another word about the serial console is if you want to read actual data from your Circuit Playground you need to use the windows app version of MakeCode, the in browser version does not support the serial console, it will only have a show simulated console which is nice because then you can learn the range that different sensors can read but at the same time it's not it's not that useful when it comes to real world values. It also it's also nice to be able to use it to learn what kind of readings things are getting in the real world so like the light sensor returns a value from 0 to 255 but like as bright as it is in this room right now is only reading at well let's look and find out.

So, if we change this acceleration to be light level and we go into our we download it to our device, we see here we have it be 73 is the reading that we're getting from our light level. So even though it returns 0 to 255 you'd think that it'd be 255 because it's bright in here but it's only 70 on the range, so you might be able to tailor your program better knowing that information you wouldn't be able to know without the serial console.

So that wraps up this section on how to use the serial console with a Circuit Playground Express and MakeCode remember that you need to use the Windows app version and MakeCode in order for it to work stick around in the next section we'll learn about communicating in other ways with your Circuit Playground or communicating with multiple Circuit Playgrounds see you there.

comments