Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Serial Communication Arduino
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GRASP
Serial Communication Arduino
Commits
8cd0bb33
Commit
8cd0bb33
authored
3 years ago
by
Bengt Ragnemalm
Browse files
Options
Downloads
Patches
Plain Diff
Moved UsbReceive.ino
parent
4967db6a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
UsbReceive.ino
+0
-59
0 additions, 59 deletions
UsbReceive.ino
with
0 additions
and
59 deletions
UsbReceive.ino
deleted
100644 → 0
+
0
−
59
View file @
4967db6a
/*************************************************************************
* Code that reads values sent from python through serial
************************************************************************/
#include
<Wire.h>
// For I2C communication with sensor
#include
<Wireling.h>
// For interfacing with Wirelings
// Make Serial Monitor compatible for all TinyCircuits processors
#if defined(ARDUINO_ARCH_AVR)
#define SerialMonitorInterface Serial
#elif defined(ARDUINO_ARCH_SAMD)
#define SerialMonitorInterface SerialUSB
#endif
void
setup
()
{
SerialMonitorInterface
.
begin
(
115200
);
Wire
.
begin
();
// Initialize Wireling
Wireling
.
begin
();
Wireling
.
selectPort
(
0
);
analogWriteResolution
(
10
);
//Change the DAC resolution to 10-bits
analogWrite
(
A0
,
0
);
// Initialize Dac to Zero
}
void
loop
()
{
int
output
;
//static float x = 270; // Current degrees for sine wave (initially 270 so that
// the sine wave is initially zero).
// output = (int) (512.0 * sin(0.017453 * x) + 512); // Sine Wave
if
(
SerialMonitorInterface
.
available
()
>
-
1
)
{
output
=
SerialMonitorInterface
.
parseInt
();
analogWrite
(
A0
,
output
);
}
// end if serial available
//analogWrite(A0, output); // Write the analog output to A0
//SerialMonitorInterface.print(output);
//SerialMonitorInterface.println();
/*
* Increment Degrees for the Next Wave Point
*
* To utilize the entire resolution of the 10-bit DAC, at least 1024
* values must be used between 0 and 360 degrees. Therefore, a step
* value greater than 360/1024 will not utilize the entier resolution
* of the DAC.
*/
//x += 0.35;
//if(x>=360.0) x -= 360.0;
//delay(1);
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment