SHCustomProtocol
 
Notifications
Clear all

SHCustomProtocol

2 Posts
3 Users
0 Reactions
990 Views
(@donutz)
Active Member
Joined: 2 years ago
Posts: 6
Topic starter  

Hi!

I just started a new project that shall control a servo. So I looked at this SHCustomProtocol topic and added some lines to SHCustomProtocol.h in order to perform some first tests. I uploaded the sketch to my Arduino Mini after applying the changes.

But it does not seem to work. I would expect to see a line like "Starting servo setup..." in Simhub's log but it does not appear. I can see lines like "[2023-04-03 10:30:04,852] INFO - Arduino debug message :Message received : 87;2" though, when I start a replay.

"C:\Program Files (x86)\SimHub\_Addons\Arduino\DisplayClientV2\SHCustomProtocol.h" now looks like:

#ifndef __SHCUSTOMPROTOCOL_H__
#define __SHCUSTOMPROTOCOL_H__

#include <Arduino.h>
#include <Servo.h>

class SHCustomProtocol {
private:

public:
//Servo myservo; // create servo object to control a servo

void setup() {
FlowSerialDebugPrintLn("Starting servo setup...");
//myservo.attach(9); // attaches the servo on pin 9 to the servo object
//myservo.write(0);
FlowSerialDebugPrintLn("Servo attached and reset.");
}

void read() {
String message = FlowSerialReadStringUntil('\n');
FlowSerialDebugPrintLn("Message received : " + message);

int speed = FlowSerialReadStringUntil(';').toInt();
//myservo.write(speed);


}
void loop() {
}
void idle() {
}
};

#endif

What am I doing wrong?

Best regards
Donutz


   
Quote
(@robertharris)
New Member
Joined: 4 months ago
Posts: 1
 

I'm diving into the world of SimHubDash, trying to figure out this whole custom protocol thing, and I'm feeling a little like I'm trying to build a pizza from scratch without Papa Louie's help! Seriously, if this stuff was as easy as papa's games , I'd be a master of custom protocols by now. But hey, at least there's a community forum, and maybe I can find some fellow pizza-lovers (or, you know, SimHubDash gurus) who can point me in the right direction.

This post was modified 4 months ago 4 times by Robertharris

   
ReplyQuote
Share: