From 0e55667b581e6d18eee7332071d926fb61f9c969 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rodrigo=20Shiordia=20L=C3=B3pez?=
 <rodrigo.shiordia@anahuac.mx>
Date: Mon, 27 Feb 2023 04:16:48 +0000
Subject: [PATCH] Update recitation/programming/slides.html

---
 recitation/programming/slides.html | 87 ++++++++++++++++++++++++++++++
 1 file changed, 87 insertions(+)

diff --git a/recitation/programming/slides.html b/recitation/programming/slides.html
index 4c90431..863db80 100644
--- a/recitation/programming/slides.html
+++ b/recitation/programming/slides.html
@@ -240,8 +240,95 @@ void loop() {
 * Functions and methods are ways of reusing code.
 * Something that you are going to do several times, you can put inside a function and use it again and again.
 * A function normally has a return value: somehting that it returns back to you after you call or invoke it. (Some functions have no return value or a void return value.)
+* It's important to distinguish between Built-in functions and custom functions. 
 
 
+---
+
+# Functions: return value
+```Arduino
+//Explaining Functions and methods
+//Rodrigo Shiordia 2023
+
+void setup() {
+  Serial.begin(9600);
+  Serial.println(" Temperature Calculator ");
+}
+
+void loop() {
+  Serial.print("Please enter temperature in Fahrenheit: ");
+
+  while (Serial.available() == 0) {
+  }
+
+  float F = Serial.parseFloat();
+
+  float C = fahrenheitToCelsius(F);
+
+  Serial.print("Temperature in Celsius: ");
+  Serial.println(C);
+}
+
+float fahrenheitToCelsius(float theValue) {
+  return (theValue -32)*0.5556;
+}
+```
+---
+
+# Functions: void return 
+```Arduino
+//Explaining Functions and methods
+//Rodrigo Shiordia 2023
+int ledPin = 1;
+
+void setup() {
+  Serial.begin(9600);
+  Serial.println(" Function based LED blinker! ");
+}
+
+void loop() {
+  Serial.print("How Many times you want the LED to blink: ");
+  while (Serial.available() == 0) {
+  }
+  int T = Serial.parseInt();
+  blinkLED(T);
+}
+
+void blinkLED(int times) {
+  for (int i = 0; i < times; i++) {
+    digitalWrite(ledPin, HIGH);
+    delay(1000);
+    digitalWrite(ledPin, LOW);
+    delay(1000);
+  }
+}
+
+```
+---
+
+# Debugging
+
+* Debugging is about getting your code to do what you want. 
+* Syntax errors are when your code is written incorrectly according to the programming language. In C/Arduino, the most common is missing a semicolon or a bracket.
+* Use checks and print statements to know exaclty what your code is doing at any time. 
+
+---
+
+# Libraries
+
+* Arduino has libraries that extend its capabilities. 
+* Libraries are collections of code that you can use. They normally provide you with functions and methods for you to use.
+---
+
+# Tips for writing programs
+
+* Always start with some idea of what you want to do. 
+* Write pseudocode. 
+* Write small blocks of code and run and upload so you know it's working before writing more code. 
+* Read as much code as you can. Writing code requires you to understand code. 
+* Use online resources: 
+  * [stackOverflow](https://stackoverflow.com/)
+  * [Arduino Forums](https://forum.arduino.cc/)
 ---
 
     </textarea>
-- 
GitLab