Mercurial > hg > beaglert
comparison projects/basic_analog_output/render.cpp @ 7:ab396a08e962
Merge
author | Victor Zappi <victor.zappi@qmul.ac.uk> |
---|---|
date | Tue, 11 Nov 2014 15:31:01 +0000 |
parents | 09f03ac40fcc |
children | a6beeba3a648 |
comparison
equal
deleted
inserted
replaced
6:db025ec86c41 | 7:ab396a08e962 |
---|---|
60 for(int channel = 0; channel < 8; channel++) { | 60 for(int channel = 0; channel < 8; channel++) { |
61 float out = kMinimumAmplitude + kAmplitudeRange * 0.5f * (1.0f + sinf(gPhase + relativePhase)); | 61 float out = kMinimumAmplitude + kAmplitudeRange * 0.5f * (1.0f + sinf(gPhase + relativePhase)); |
62 if(out > MATRIX_MAX) | 62 if(out > MATRIX_MAX) |
63 out = MATRIX_MAX; | 63 out = MATRIX_MAX; |
64 | 64 |
65 matrixOut[n * 8 + channel] = (uint16_t)out; | 65 analogWrite(channel, n, out); |
66 | 66 |
67 // Advance by pi/4 (1/8 of a full rotation) for each channel | 67 // Advance by pi/4 (1/8 of a full rotation) for each channel |
68 relativePhase += M_PI * 0.25; | 68 relativePhase += M_PI * 0.25; |
69 } | 69 } |
70 | 70 |