0

I try this example with my particle Photon: https://github.com/technobly/Remote-Spark/blob/master/JUSTGAUGE%20DEMO/index.html

I get the result "$Y" if i send a value from my particle cloud into the website. The Website is running local on a node.js server.

Object {cmd: "VarReturn", name: "RFID-SCAN", result: "$Y", coreInfo: Object}

The result should be an HEX value like "6da24659" and send as string in the particle cloud. In the cloud i get the right value. The only problem is the way from the cloud to the website.


For a better understanding, in the following my code for photon:

// Serial Communication with Sharp Distance Sensor and RFID Reader
...

int int_value;

void setup() {
 byte i, port, status;
 Serial.begin(9600);
 SPI.begin();
 mfrc522.PCD_Init(); 
}

void loop() {
 int sensorValue = analogRead(A0);
 Serial.write(sensorValue);
 Particle.publish("SENSOR-VALUE", String(sensorValue), 60, PUBLIC);
 Particle.variable("SENSOR-VALUE", &sensorValue, INT);
 delay(1000);

 if ( ! mfrc522.PICC_IsNewCardPresent())
{
 return;
}

if ( ! mfrc522.PICC_ReadCardSerial())
{
 return;
}

String cardID;

for (byte i = 0; i < mfrc522.uid.size; i++) {
    cardID += String(mfrc522.uid.uidByte[i] < 0x10 ? "0" : "");
    cardID += String(mfrc522.uid.uidByte[i], HEX);
 }

Serial.write(cardID);
Particle.publish("RFID-SCAN", String(cardID), 60, PUBLIC);
Particle.variable("RFID-SCAN", &cardID, STRING);
delay(1000);
}

Anyone who can help?

Joneman
  • 9
  • 3
  • You should get in the habit of searching for your error message before asking new questions on Stack Overflow. There are hundreds of results for the access control error you're getting. – user229044 Jul 17 '17 at 16:11
  • Thank you for the answer, but the topic “No 'Access-Control-Allow-Origin' header is present on the requested resource” is not the main issue. My main problem is the false result: "$Y" which should be a string. – Joneman Jul 17 '17 at 16:26

0 Answers0