Hi at @zjnmbyn24
welcome to the arduino-forum
This tutorial will help you finishinh your project faster
Take a look into this tutorial:
It is easy to understand and has a good mixture between explaining important concepts and example-codes to get you going. So give it a try and report your opinion about this tutorial.
the most obvious errors in your code are
void setup()
{
pinMode(yellow_LED_PIN, OUTPUT);
pinMode(smoke_detector, INPUT);
} // closing curly brace
// which means
Serial.begin(9600); // <== this line is OUTSIDE of function setup()
} // <<<<<<< this closing curly brace has no
// corresponding opening curly brace
void loop() {
int sensor_read = analogRead(smoke_detector);
Serial.print("Smoke Density: ");
Serial.println(sensor_read);
if (sensor_read > safety_lim)
//
{ // <===== opening curly brace
analogWrite(yellow_LED_PIN, 0);
{ // <== opening curly brace
} // <== corresponding closing curly brace
// <===== closing curly brace is missing
// but the corresponding closing curly braces are missing
// at least in the lines of code that you have posted
best regards Stefan