Skip to content

4. Embedded programming

This week we worked with the coding to program ARDUINO NANO 33 SENSE BOARD.

information about arduino nano 33

I will share some information about the board

The Arduino Nano 33 BLE is a Nano-sized board with Bluetooth connectivity and a 9-axis inertial measurement unit (IMU) that adds a compass to the usual gyroscope and accelerometer.

There are many sensors within the board.

“The Arduino Nano 33 BLE Sense is a completely new board on a well-known form factor. It comes with a series of embedded sensors: 9 axis inertial sensor: what makes this board ideal for wearable devices humidity, and temperature sensor: to get highly accurate measurements of the environmental conditions barometric sensor: you could make a simple weather station microphone: to capture and analyse sound in real time gesture, proximity, light color and light intensity sensor : estimate the room’s luminosity, but also whether someone is moving close to the board”

Here a photo that showed the pins in the BOARD

We can notice that there some pins for analoge and digital

So here is the explenation about the difference between them :

Analog Signals:

The analog signals were used in many systems to produce signals to carry information. These signals are continuous in both values and time. The use of analog signals has been declined with the arrival of digital signals. In short, to understand analog signals – all signals that are natural or come naturally are analog signals.

Digital Signals:

Unlike analog signals, digital signals are not continuous, but signals are discrete in value and time. These signals are represented by binary numbers and consist of different voltage values.

Batteries:

the Nano 33 BLE Sense has no battery connector, nor charger. You can connect any external battery of your liking as long as you respect the voltage limits of the board.

programming

First of all, we downloaded ARDUINO app and we adjust the sitting.

After that, we tried a code that prepared in ARDUINO app.

This code make the LED light on for 1 sec and off for 1 sec.

// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);                       // wait for a second
}
int ledPin = 13;
int blinkTime = 500;

void setup()
{
  pinMode(ledPin, OUTPUT);
  blinkyBlinky(5, blinkTime); // 5 is number of blinks, blinkTime is the milliseconds in each state from above: int blinkTime = 500;
}

void loop()
{
  //
}

void blinkyBlinky(int repeats, int time)
{
  for (int i = 0; i < repeats; i++)
  {
    digitalWrite(ledPin, HIGH);
    delay(time);
    digitalWrite(ledPin, LOW);
    delay(time);
  }
}

If you have this error you can follow the steps on this photo.

morse code

Morse code is a method used in telecommunication to encode text characters as standardized sequences of two different signal durations, called dots and dashes, or dits and dahs.

I used the morse code that have been used in interstellar movie.

This is the code that I use :

int dot=500;
int dash=1000;

void setup() {
  // put your setup code here, to run once:
  pinMode(LED_BUILTIN, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  switchLED_BUILTIN(dot);  // for s
  switchLED_BUILTIN(dot);
  switchLED_BUILTIN(dot);
  delay(2000);
  switchLED_BUILTIN(dash);  // for t
  delay(2000);
  switchLED_BUILTIN(dot);   // for a
  switchLED_BUILTIN(dash);
  delay(2000);
  switchLED_BUILTIN(dash);  // for y
  switchLED_BUILTIN(dot);
  switchLED_BUILTIN(dash);
  switchLED_BUILTIN(dash);
  delay(2000);
}
void switchLED_BUILTIN(int timing) {
  digitalWrite(LED_BUILTIN, HIGH);   
  delay(timing);                       
  digitalWrite(LED_BUILTIN, LOW);    
  delay(500);
}

Visual studio code program

I installed Visual studio, then I Installed PlatformIO IDE.

I didn’t know how to coplete the process so i went to another program (tinkercad)

tinkercad

I tried to do the known code which is blink


Last update: January 17, 2022