/************************
* Project Name: A2.14b
* File Name: Act_2.14b.ino
* Revision: 1.0
* Microcontroller name: Arduino UNO
* Compiler: Arduino IDE 1.18.19
* Created by: Ivan Seidel
* Researched from:
* Arduino LinkedList library: https://www.arduino.cc/reference/en/libraries/linkedlist/
* And Slide 11 of presentation AI-uC 8 pointers & functions
*
* Modified by: César Augusto Madueño Aceves
* E-mail: [email protected]
* Date: 04.11.2022 (dd/mm/yyyy)
=====================================================================
* DESCRIPTION:
Follow instructions of slide 11 of today (friday 21/10722)
powerpoint presentation AI-uC 8 pointers & functions
Print code and result on serial monitor.
Change some of the values to print different numbers.
************************/
#include <LinkedList.h>
LinkedList<int> myList = LinkedList<int>();
void setup()
{
Serial.begin(9600);
// Add some stuff to the list
int k = -240, l = 123, m = -2, n = 222;
myList.add(n);
myList.add(0);
myList.add(l);
myList.add(17);
myList.add(k);
myList.add(m);
}
void loop() {
int listSize = myList.size();
Serial.print("There are ");
Serial.print(listSize);
Serial.print(" integers in the list. The negative ones are: ");
// Print Negative numbers
for (int h = 0; h < listSize; h++) {
// Get value from list
int val = myList.get(h);
// If the value is negative, print it
if (val < 0) {
Serial.print(" ");
Serial.print(val);
}
}
while (true);
// nothing else to do, loop forever
}