Can't get Temperature to RGB light for school project!

I am new to Arduino and I am trying to get my board to read the temperature, display the temperature and then depending on the temperature show a different colour on the RGB light. Without any of the RGB code it reads and displays the temperature completely fine. Also, the RGB runs if I just run an RGB code. I’ve been trying to do this for a while now and I really need to get it done.

I have attached my current code as a screenshot to this post. There is usually an else statement where the if is now but it doesn’t seem to take the else as a proper statement. The current error is get is:

TypeError: Cannot read property ‘type’ of null
at Function.Pins.normalize (/Users/NicholasBlount/code/boscode-learn/node_modules/johnny-five/lib/board.pins.js:91:24)
at Board.Component (/Users/NicholasBlount/code/boscode-learn/node_modules/johnny-five/lib/board.js:839:23)
at new RGB (/Users/NicholasBlount/code/boscode-learn/node_modules/johnny-five/lib/led/rgb.js:163:19)
at Object. (/Users/NicholasBlount/code/boscode-learn/code/arduino/01/ardx/CIRC10-code-temperaturesensor.js:4:15)
at Module._compile (module.js:410:26)
at Object.Module._extensions…js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Function.Module.runMain (module.js:442:10)
at startup (node.js:136:18)
at node.js:966:3

I’ll happily add any other information needed if I haven’t put something in to this post. I’d really appreciate any and all help! Thanks!

PS I’m using a mac, just so you know

Problem 1: This is an Arduino forum (where code is C or C++) and that code is JavaScript.

Problem 2: The code should not be posted in the form of a picture. The 3 locked posts at the top of the forum point to the correct procedure.

Ok. I’m sorry, just our teacher gave us a SparkFun Redboard and says its an Arduino and it all codes the same and stuff.

I’m really not good at any of this.

var five = require(“johnny-five”);

var board = new five.Board();
var myLed = new five.Led.RGB([ 9, 10, 11 ]);

board.on(“ready”, function() { //Gets the board ready
var temp = new five.Temperature({ //Defines the variable “temp”
pin: “A0”,//References the pin
controller: “TMP36” //References the controller

temp.on(“change”, function() { //starts loop
console.log(“Temp: %d”, Math.ceil(temp.celsius)); //Prints the temp in the console and rounds the number

if (temp <= 20)
this.wait( 1000, function() {
// make the LED blue after 1 second
if ( (temp > 20) && (temp > 20) )

Hi, Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.,148850.0.html then look down to item #7 about how to post your code. It will be formatted in a scrolling window that makes it easier to read.

Where did you get this code from? As pointed out it is not in C++ that the IDE uses.

Can you post your two working sketches?

Thanks.. Tom.... :)