Test sketch for Arduino Controlled Pc Power Switch not working

Hello there I hope someone will be able to help me with a project.
I want to use digital pin 13 (or any pin for that matter) to replace my power switch on my pc. And then short that pin to gnd when the arduino receives an ir signal from remote conceded to pin 4.
I then want to include having all remote buttons do something on the pc. A bit like the tutorial on instructables by HactiCs called “IR remote control your laptop with arduino uno”

But it uses vb express. and i dont want to use that.

Is there a way to make the code run from within another platform like eventghost or python?

I cannot seem to find why its not working probably as I’m a noob.
Here is my code

#include <IRremote.h>
const int RECV_PIN = 4;
const int redPin = 13;
// Define IR Receiver and Results Objects
IRrecv irrecv(RECV_PIN);//irrecv is the receiver object, you can use whatever name you want
decode_results results;

int buttonState = 0;
int togglestate = 0;

int incomingByte;
int state = HIGH;
int reading;
int previous = LOW;

void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
pinMode(redPin, OUTPUT);
}
void loop(){
if (irrecv.decode(&results)) {// irrecv.decode(&results) :Returns true if a code was receive
Serial.println(results.value, HEX);
if(results.value==0xFF28D7){
digialWrite(redPin, LOW);
delay(500);
digitalWrite(redPin, HIGH);
}
delay(300);// this delay is here to avoid the 0xFFFFFFF
irrecv.resume (); // Receive the next value
}
}

1) Please read How to use this forum - please read, specifically point 7 how to post code.

Your code is small enough to add in the post.

2) Please post a link to that instructable.

3) What is not working? You're current code? What do you expect it to do and what does it do?

4) Don't use pin 13, it's used when the arduino boots and will have side effects.

sterretje: 4) Don't use pin 13, it's used when the arduino boots and will have side effects.

And to elaborate: On the Arduino Uno, Pin 13 is tied to an LED on the board, and thus is already driving a load, which leaves less for other devices connected to that pin.

Also know that Arduino Uno pins are incapable of driving more than 20mA, comfortably, and 40mA MAX [i.e. on the borderline of meltdown].

On an original Uno R3, that load is low as the led is buffered by an opamp. However, clones might not have that; I have a sparkfun redboard without that opamp and cheap chinese clones are probably the same to save costs.

Hi noob-code-bunny,

Kindly put your code inside code tags, so it looks like this:

#include <IRremote.h>
const int RECV_PIN = 4;
const int redPin = 13;
// Define IR Receiver and Results Objects
IRrecv irrecv(RECV_PIN);//irrecv is the receiver object, you can use whatever name you want
decode_results results;

int buttonState = 0;
int togglestate = 0;


int incomingByte;  
int state = HIGH;
int reading;
int previous = LOW;

void setup()
{
 Serial.begin(9600);
 irrecv.enableIRIn(); // Start the receiver
 pinMode(redPin, OUTPUT);
}
void loop(){
 if (irrecv.decode(&results)) {// irrecv.decode(&results) :Returns true if a code was receive
   Serial.println(results.value, HEX);
   if(results.value==0xFF28D7){
     digialWrite(redPin, LOW);
     delay(500);
     digitalWrite(redPin, HIGH);
    }
    delay(300);// this delay is here to avoid the 0xFFFFFFF
    irrecv.resume (); // Receive the next value
  }
 }

Beyond that, are you paying attention to things like:

I looked at some of the source code, and first I must admit that my C++ is very rusty, but I see that it has a way of either sensing the manufacturer’s protocol, AND/OR a way of selecting a manufacturer, but I can’t figure out how it works. But, it looks like that test code [4th bullet] is designed to test various protocols and report which one it sensed. Perhaps a clue, as to how this is done, it in that code – especially if you run it, and it, indeed, reports something that makes sense.