This mode is designed for those who are not using an External Clock Signal.In this mode, you utilize one camera in leader mode (outputting a synchronization signal) and the
remaining cameras in follower mode.
This mode is designed for those who are using an External Clock Signal to output the synchronization signal for all cameras.In this mode, you utilize all cameras in follower mode.
Add the .ZIP library (the source code downloaded in the last step)
3
Upload one of the two sketches below to your Arduino. Simple Control is the quickest way to get started, but requires reflashing the firmware if you need to adjust your FPS later. Serial Control allows you to adjust frequency and duty cycle in real-time without reflashing, though these settings will reset if the device loses power.
Simple Control
Serial Commands
Copy
Ask AI
#include <PWM.h>// Pin configurationint pin = 9; // pinint value = 127; // Initial value for the PWM duty cycle// SET FREQUENCY HEREfloat frequency = 60; // Initial frequency in Hzvoid setup(){ // Initialize all timers except for timer0 to save timekeeping tasks InitTimersSafe(); // Set the initial PWM frequency and duty cycle if (SetPinFrequencySafe(pin, frequency)) { pwmWrite(pin, value); Serial.println("PWM frequency and initial duty cycle set."); } else { Serial.println("Failed to set frequency."); }}
Copy
Ask AI
#include <PWM.h>// Pin configurationint pin = 9; // pinint value = 127; // Initial value for the PWM duty cyclefloat frequency = 60; // Initial frequency in Hzvoid setup(){ Serial.begin(9600); // Initialize all timers except for timer0 to save timekeeping tasks InitTimersSafe(); // Set the initial PWM frequency and duty cycle if (SetPinFrequencySafe(pin, frequency)) { pwmWrite(pin, value); Serial.println("PWM frequency and initial duty cycle set."); } else { Serial.println("Failed to set frequency."); }}void loop(){ if (Serial.available()) { // Read frequency and duty cycle values over Serial String inputString = Serial.readStringUntil('\n'); // Read string input until newline inputString.trim(); // Remove any extraneous spaces or newlines int freqDutySplitIndex = inputString.indexOf(','); if (freqDutySplitIndex != -1) { String freqStr = inputString.substring(0, freqDutySplitIndex); // Extract frequency string String dutyStr = inputString.substring(freqDutySplitIndex + 1); // Extract duty cycle string // Parse floats float newFrequency = freqStr.toFloat(); int newDutyCycle = dutyStr.toInt(); // Validate frequency range if (newFrequency >= 1 && newFrequency <= 2000000) { // Set the PWM frequency and apply duty cycle if (SetPinFrequencySafe(pin, newFrequency)) { value = map(constrain(newDutyCycle, 0, 100), 0, 100, 0, 255); pwmWrite(pin, value); Serial.print("Set frequency to: "); Serial.print(newFrequency); Serial.print(" Hz, duty cycle to: "); Serial.print(newDutyCycle); Serial.println("%"); } else { Serial.println("Failed to set new frequency."); } } else { Serial.println("Invalid frequency value."); } } else { Serial.println("Invalid input format. Use frequency,dutycycle (e.g., 60,50)."); } }}
This code allows you to modify the PWM signal on the fly. Open your serial monitor at 9600 baud and send commands using the format {FREQUENCY},{DUTY_CYCLE} (e.g., 60,50 for 60Hz at a 50% duty cycle).
In addition to our upcoming SDK, we now provide a simple process to grab synchronized frames from your various camera setups. This may be phased out in favor of the fully features SDK down the line.
Find the device ID of the two cameras you would like to utilize, and then choose a device ID number that is not listed.In our case, the number we are choosing is 9, since it is not used above.We will use this unused device ID for the virtual device we are going to create.Here, we create a virtual device for two stitched videos. We use the output ID of 9 and virtual device name of stellarHD_stitched.Using the following command, you can replace 9 with your chosen device ID:
Note, you will need to keep this command running while using the synchronized, stitched videos.
You can modify this command to add more cameras, change resolutions and framerates, or change layouts as you wish.