Arduino Forum

Community => Gigs and Collaborations => Topic started by: paulelder on Mar 22, 2019, 12:26 pm

Title: need a program writen
Post by: paulelder on Mar 22, 2019, 12:26 pm
hello I need help new at this and need a small program written to control a frequency board to change 4 times and the duty to change each time to then repeat over and over then I can mod it from there and learn please help 

Communication standard: 9600 bps data bits: 8
Stop bit :1
Check digit :none
Flow control : none

1, set the frequency of the PWM

"F101": Set the frequency to 101 HZ (001~999)

"F1.05": Set the frequency to 1.05 KHZ (1.00~9.99)

"F10.5": Set the frequency to 10.5KHZ (10.0~99.9)

"F1.0.5": Set the frequency to 105KHZ (1.0.0~1.5.0)

2, set the duty cycle of the PWM

"Dx:yyy": set the duty cycle of PWM x: (1~3) PWM serial number, yyy: (000~100) duty cycle %;

For example, D1:050, set the first PWM duty cycle to 50%.

3, read the setting parameters

Send a "read" string and read the set parameters.

The read data format is as follows: F156, D1: 052, D2: 059, D3: 058,

Set the success to return: DOWN;

Setting failed to return: FALL.
Title: Re: need a program writen
Post by: GaryP on Mar 22, 2019, 07:34 pm
Wait for Paul's...

Title: Re: need a program writen
Post by: 6v6gt on Mar 24, 2019, 12:22 pm
Can you start with this, hacking it if necessary to get it just to do something:

Code: [Select]

// connect pin 10 to the TX pin of your device
// connect pin 11 to the RX pin of your device

#include <SoftwareSerial.h>
SoftwareSerial pwmBoard(10, 11); // RX, TX

void setup() {
  // Open serial communications and wait for port to open:
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only

  Serial.println("Starting. . .");

  // set the data rate for the SoftwareSerial port
  delay(1000) ;
  Serial.println( "Sending F156" ) ;

  delay(1000) ;
  Serial.println( "Sending D1:050" ) ;

  delay(1000) ;
  Serial.println( "Sending D1:052" ) ;

  delay(1000) ;
  Serial.println( "Sending D2:059" ) ;

  delay(1000) ;
  Serial.println( "Sending D1:052" ) ;

  delay(1000) ;
  Serial.println( "Sending read" ) ;

  while ( pwmBoard.available() ) {
    Serial.print( ) ;
  Serial.println() ;
  Serial.print("end") ;

void loop() {}